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 7a0933d696..992b94ff5e 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,6 +55,13 @@ 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))); @@ -68,6 +76,9 @@ namespace CalamityMod.Balancing // 25% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(ResistTrueMelee(0.75f)))); + + // 40% resist to Lemon 'nade + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(new ProjectileResistBalancingRule(0.60f, ProjectileType())))); #endregion #region Brain of Cthulhu: Creepers @@ -204,6 +215,9 @@ namespace CalamityMod.Balancing // 50% resist to Charged Blaster Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.ChargedBlasterLaser)))); + //45% resist to Duststorm in a Bottle + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 40% resist to Stardust Dragon Staff. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); diff --git a/BiomeManagers/PolypForestBiome.cs b/BiomeManagers/PolypForestBiome.cs index 564264d40e..a3bdc5de94 100644 --- a/BiomeManagers/PolypForestBiome.cs +++ b/BiomeManagers/PolypForestBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public class PolypForestBiome : ModBiome { - public override ModWaterStyle WaterStyle => SunkenSeaPolypWater.Instance; + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; diff --git a/BiomeManagers/RadiantReefsBiome.cs b/BiomeManagers/RadiantReefsBiome.cs index c613bfbf67..90455c46ad 100644 --- a/BiomeManagers/RadiantReefsBiome.cs +++ b/BiomeManagers/RadiantReefsBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public class RadiantReefsBiome : ModBiome { - public override ModWaterStyle WaterStyle => SunkenSeaReefsWater.Instance; + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 02d7bf8488..88ad13e54e 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -4,6 +4,7 @@ using System; using Mono.Cecil.Cil; using MonoMod.Cil; using CalamityMod.Systems; +using Terraria.ID; namespace CalamityMod.BiomeManagers { @@ -11,7 +12,7 @@ namespace CalamityMod.BiomeManagers public class SunkenSeaBiome : ModBiome { public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; public override void Load() { //apply the drawblack edits here since all sunken sea biomes will have custom backgrounds @@ -63,8 +64,8 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 1000 || - BiomeTileCounterSystem.SunkenSeaReefsTiles > 1000 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 200 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 200 || + BiomeTileCounterSystem.SunkenSeaReefsTiles > 200 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 200; } } } diff --git a/BiomeManagers/TimelessShoresBiome.cs b/BiomeManagers/TimelessShoresBiome.cs index 66e93668fd..461599413f 100644 --- a/BiomeManagers/TimelessShoresBiome.cs +++ b/BiomeManagers/TimelessShoresBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public class TimelessShoresBiome : ModBiome { - public override ModWaterStyle WaterStyle => SunkenSeaShoresWater.Instance; + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int BiomeTorchItemType => ModContent.ItemType(); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; diff --git a/Buffs/Alcohol/BaconOilBuff.cs b/Buffs/Alcohol/BaconOilBuff.cs index 964aa03e37..c2903d95b5 100644 --- a/Buffs/Alcohol/BaconOilBuff.cs +++ b/Buffs/Alcohol/BaconOilBuff.cs @@ -1,4 +1,5 @@ using CalamityMod.DataStructures; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Buffs.Alcohol Main.buffNoSave[Type] = false; Main.persistentBuff[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/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/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 45797d83fe..11edc8040c 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.DamageOverTime { @@ -51,7 +52,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; BuffID.Sets.IsATagBuff[Type] = true; } 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 index 33f970a97f..4b5197bc2b 100644 --- a/Buffs/DamageOverTime/WindChilled.cs +++ b/Buffs/DamageOverTime/WindChilled.cs @@ -1,14 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Particles; -using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -31,12 +26,12 @@ 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 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); } @@ -94,7 +89,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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, + 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); } diff --git a/Buffs/Pets/BeldumBuff.cs b/Buffs/Pets/BeldumBuff.cs new file mode 100644 index 0000000000..7ee2658caa --- /dev/null +++ b/Buffs/Pets/BeldumBuff.cs @@ -0,0 +1,27 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class BeldumBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().beldum = true; + bool PetProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/Pets/BeldumBuff.png b/Buffs/Pets/BeldumBuff.png new file mode 100644 index 0000000000..610a378258 Binary files /dev/null and b/Buffs/Pets/BeldumBuff.png differ diff --git a/Buffs/Placeables/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..c4e47d8cc1 100644 Binary files a/Buffs/Placeables/CorruptionEffigyBuff.png and b/Buffs/Placeables/CorruptionEffigyBuff.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/SwinesWrathBuff.cs b/Buffs/Potions/SwinesWrathBuff.cs index 873555d6c3..14ae221f5b 100644 --- a/Buffs/Potions/SwinesWrathBuff.cs +++ b/Buffs/Potions/SwinesWrathBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Potions; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ namespace CalamityMod.Buffs.Potions public class SwinesWrathBuff : ModBuff { public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer"); + public static readonly SoundStyle TimerSound2 = new("CalamityMod/Sounds/Custom/TickingTimerReverb"); public override void SetStaticDefaults() { @@ -33,10 +35,14 @@ namespace CalamityMod.Buffs.Potions { player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SwinesWrath" + Main.rand.Next(1, 7 + 1)).ToNetworkText(player.name)), 1000, -1); concoctionPlayer.swinesWrathCounter = -1; + concoctionPlayer.spamTimer = 0; } else if (concoctionPlayer.swinesWrathCounter % 60 == 59) - SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f) }, player.Center); // Gets louder as time progresses + { + SoundEngine.PlaySound(TimerSound2 with { Volume = MathF.Pow((600f - concoctionPlayer.swinesWrathCounter) / 600f, 2) * 0.8f, MaxInstances = -1 }, player.Center); // Gets louder as time progresses + SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f), MaxInstances = -1 }, player.Center); // Gets louder as time progresses + } } } } diff --git a/Buffs/StatBuffs/FortunesFavor.cs b/Buffs/StatBuffs/FortunesFavor.cs deleted file mode 100644 index 64b9d077ee..0000000000 --- a/Buffs/StatBuffs/FortunesFavor.cs +++ /dev/null @@ -1,48 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class FortunesFavor : ModBuff - { - public static int FortunesFavorRegenBoost = 3; - - public override LocalizedText Description => base.Description.WithFormatArgs(FortunesFavorRegenBoost.ToRegenPerSecond()); - - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().fortunesFavor = true; // Draw FX handled in CalamityPlayerDrawEffects as is standard for regen buffs - } - - public override void Update(NPC npc, ref int buffIndex) - { - npc.Calamity().fortunesFavor = true; - } - - internal static void DrawEffects(NPC npc, ref Color drawColor) - { - Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); - - if (Main.rand.NextBool(16)) - { - Particle Plus = new HealingPlus(npcSize, Main.rand.NextFloat(0.3f, 0.5f), new Vector2(0, Main.rand.NextFloat(-2f, -3.5f)) + npc.velocity, Color.Gold, Color.Goldenrod, Main.rand.Next(9, 13)); - GeneralParticleHandler.SpawnParticle(Plus); - } - Lighting.AddLight(npc.Center, Color.Gold.ToVector3() * 0.1f); - } - - } -} diff --git a/Buffs/StatBuffs/FortunesFavor.png b/Buffs/StatBuffs/FortunesFavor.png deleted file mode 100644 index 4f8923c51f..0000000000 Binary files a/Buffs/StatBuffs/FortunesFavor.png and /dev/null differ diff --git a/Buffs/StatBuffs/SmashedEvil.cs b/Buffs/StatBuffs/SmashedEvil.cs index 9991a19dad..57f5c2ac60 100644 --- a/Buffs/StatBuffs/SmashedEvil.cs +++ b/Buffs/StatBuffs/SmashedEvil.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories; using Terraria; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.Buffs.StatBuffs { @@ -47,7 +48,7 @@ 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) 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/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/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 49c98487b6..fb3de46490 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -36,6 +36,7 @@ using CalamityMod.Items.Armor.TitanHeart; using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Dyes; +using CalamityMod.Items.Fishing; using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.Mounts.Minecarts; @@ -68,7 +69,9 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; using CalamityMod.Systems.Mechanic; +using CalamityMod.Tiles.Abyss; using CalamityMod.Utilities; +using CalamityMod.Walls.UnsafeWalls; using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -433,6 +436,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; @@ -599,6 +603,7 @@ namespace CalamityMod.CalPlayer public bool lordePet = false; public bool frostyBat = false; public bool toastyBat = false; + public bool beldum = false; public bool starSwallowerPetFroge = false; #endregion @@ -1063,9 +1068,6 @@ namespace CalamityMod.CalPlayer 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; @@ -1148,6 +1150,7 @@ namespace CalamityMod.CalPlayer public bool scionsCurioVisuals = false; public float scionsCurioDebuffDamage = 0; public bool frozenCube = false; + public bool frozenCubeVanity = false; public bool frozenCubeVisuals = false; public float frozenCubeDebuffBoost = 0; public float frozenCubeElumphantBoost = 0; @@ -1227,12 +1230,8 @@ namespace CalamityMod.CalPlayer 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. 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; @@ -1392,7 +1391,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; @@ -1466,7 +1464,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; @@ -2314,6 +2311,7 @@ namespace CalamityMod.CalPlayer lordePet = false; frostyBat = false; toastyBat = false; + beldum = false; starSwallowerPetFroge = false; onyxExcavator = false; @@ -2502,7 +2500,6 @@ namespace CalamityMod.CalPlayer fadedIdolatry = false; pSoulArtifact = false; giantPearl = false; - shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; sPauldron = false; @@ -2537,7 +2534,7 @@ namespace CalamityMod.CalPlayer camper = false; corrosiveSpine = false; scionsCurio = false; - frozenCube = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0; + frozenCube = false; frozenCubeVanity = false; frozenCubeDebuffBoost = 0; frozenCubeElumphantBoost = 0; frozenCubeUsedDefense = 0; rottenDogTooth = false; angelicAlliance = false; ChaosStone = false; @@ -2611,11 +2608,8 @@ namespace CalamityMod.CalPlayer necroSet = false; frostSet = false; - victideBarrierSet = false; - victideBarrierHead = false; - victideBurrowSet = false; - victideBurrowHead = false; - victideSnailSet = false; + victideSet = false; + victideSummoner = false; sulphurSet = false; @@ -2696,7 +2690,6 @@ namespace CalamityMod.CalPlayer staticDischarge = false; miracleBlight = false; armorCrunch = false; - crumble = false; irradiated = false; bane = false; brimstoneFlames = false; @@ -2783,7 +2776,6 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; - fortunesFavor = false; PinkJellyRegen = false; GreenJellyRegen = false; AbsorberRegen = false; @@ -3185,7 +3177,6 @@ namespace CalamityMod.CalPlayer staticDischarge = false; miracleBlight = false; armorCrunch = false; - crumble = false; irradiated = false; bane = false; brimstoneFlames = false; @@ -3299,7 +3290,6 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; - fortunesFavor = false; PinkJellyRegen = false; GreenJellyRegen = false; AbsorberRegen = false; @@ -3431,10 +3421,7 @@ 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; @@ -3462,8 +3449,6 @@ namespace CalamityMod.CalPlayer xerocSet = false; tracersDust = false; GemTechState.OnDeathEffects(); - shieldOfTheOceanParry = 0; - shieldOfTheOceanEmpoweredParry = false; blazingCoreParry = 0; blazingCoreEmpoweredParry = false; blazingCoreSuccessfulParry = 0; @@ -3844,12 +3829,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 @@ -4025,36 +4004,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) @@ -4323,10 +4272,10 @@ namespace CalamityMod.CalPlayer { int foundX = -1; int foundY = -1; - bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; - int xSearchEnd = dungeonOnRightSide ? 20 : Main.maxTilesX - 20; + bool templeOnLeftSide = Main.dungeonX > Main.spawnTileX; + int xSearchEnd = templeOnLeftSide ? 20 : Main.maxTilesX - 20; - if (dungeonOnRightSide) + if (templeOnLeftSide) { for (int i = Main.spawnTileX; i >= xSearchEnd; i -= 2) { @@ -4368,9 +4317,9 @@ namespace CalamityMod.CalPlayer return null; int attempts = 25; - int rangeX = 300; - int rangeY = 300; - int randomFluff = 500; + int rangeX = 100; + int rangeY = 100; + int randomFluff = 400; Point finalTeleportPoint = Point.Zero; for (int i = 0; i < attempts; i++) { @@ -4378,13 +4327,13 @@ namespace CalamityMod.CalPlayer { for (int y = 0; y <= rangeY; y++) { - int teleportPosX = foundX + x + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosX = foundX + (templeOnLeftSide ? x : -x) + Main.rand.Next(-randomFluff, randomFluff); int teleportPosY = foundY + y + Main.rand.Next(-randomFluff, randomFluff); Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); - if (!tileAbove.HasTile && tileBelow.HasTile && tile.WallType == WallID.LihzahrdBrickUnsafe) + if (!tileAbove.HasTile && WorldGen.ActiveAndWalkableTile(tileBelow.X(), tileBelow.Y()) && tile.WallType == WallID.LihzahrdBrickUnsafe) { finalTeleportPoint = new(tile.X(), tile.Y()); if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) @@ -4403,28 +4352,83 @@ namespace CalamityMod.CalPlayer /// public static Vector2? GetAbyssVoidTeleportPosition(Player player) { - bool canSpawn = false; int halfWorldWidth = Main.maxTilesX / 2; - int abyssStartX = Abyss.AtLeftSideOfWorld ? halfWorldWidth - (halfWorldWidth - 135) + 35 : halfWorldWidth + (halfWorldWidth - 135) - 35; - int abyssXRange = 50; + int abyssEndX = Abyss.AtLeftSideOfWorld ? 0 : Main.maxTilesX; - int teleportStartY = Main.remixWorld ? SulphurousSea.YStart - (int)(Main.UnderworldLayer * 0.6f) : Main.maxTilesY - 300; - int teleportRangeY = 80; + int foundX = -1; + int foundY = -1; - Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings + if (Abyss.AtLeftSideOfWorld) { - mostlySolidFloor = false, - avoidAnyLiquid = false, - avoidLava = true, - avoidHurtTiles = true, - avoidWalls = false, - attemptsBeforeGivingUp = 1000, - maximumFallDistanceFromOrignalPoint = 10 - }; + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) + { + for (int x = abyssStartX; x >= abyssEndX; x -= 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (tile.TileType == ModContent.TileType()) + { + foundX = x; + foundY = y; + break; + } + } - Vector2 teleportPosition = player.CheckForGoodTeleportationSpot(ref canSpawn, abyssStartX, abyssXRange, teleportStartY, teleportRangeY, settings); - return canSpawn ? teleportPosition : null; + if (foundY != -1) + break; + } + } + else + { + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) + { + for (int x = abyssStartX; x <= abyssEndX; x += 2) + { + Tile tile = Framing.GetTileSafely(x, y); + if (tile.TileType == ModContent.TileType()) + { + foundX = x; + foundY = y; + break; + } + } + + if (foundY != -1) + break; + } + } + + if (foundY == -1) + return null; + + int attempts = 25; + int rangeX = 100; + int rangeY = 200; + int randomFluff = 200; + Point finalTeleportPoint = new(foundX, foundY); + for (int i = 0; i < attempts; i++) + { + for (int x = 0; x <= rangeX; x++) + { + for (int y = 0; y <= rangeY; y++) + { + int teleportPosX = foundX + (Abyss.AtLeftSideOfWorld ? x : -x) + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosY = foundY - y + Main.rand.Next(-randomFluff, randomFluff); + Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); + Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); + Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); + + if (!tileAbove.HasTile && WorldGen.ActiveAndWalkableTile(tileBelow.X(), tileBelow.Y()) && tile.WallType == ModContent.WallType()) + { + finalTeleportPoint = new(tile.X(), tile.Y()); + if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) + break; + } + } + } + } + + return finalTeleportPoint.ToWorldCoordinates() - new Vector2(player.width, player.height); } /// @@ -4436,20 +4440,20 @@ namespace CalamityMod.CalPlayer // Define an area around the center to search for a valid spot to tp int teleportStartX = WorldgenManagementSystem.DungeonArchivePos.X; int teleportStartY = WorldgenManagementSystem.DungeonArchivePos.Y; + bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; // Manually search for the Archives from the bottom of the world if the Archive position isn't saved. if (WorldgenManagementSystem.DungeonArchivePos == Point.Zero) { int foundX = -1; int foundY = -1; - bool dungeonOnRightSide = Main.dungeonX > Main.spawnTileX; int xSearchStart = dungeonOnRightSide ? Main.maxTilesX - 20 : 20; if (dungeonOnRightSide) { - for (int y = Main.UnderworldLayer; y > (int)Main.rockLayer; y--) + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) { - for (int x = xSearchStart; x >= Main.maxTilesX / 2; x -= 2) + for (int x = xSearchStart; x >= Main.spawnTileX; x -= 2) { Tile tile = Framing.GetTileSafely(x, y); if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) @@ -4466,9 +4470,9 @@ namespace CalamityMod.CalPlayer } else { - for (int y = Main.UnderworldLayer; y > (int)Main.rockLayer; y--) + for (int y = Main.maxTilesY; y >= (int)Main.worldSurface; y--) { - for (int x = xSearchStart; x <= Main.maxTilesX / 2; x += 2) + for (int x = xSearchStart; x <= Main.spawnTileX; x += 2) { Tile tile = Framing.GetTileSafely(x, y); if (Main.wallDungeon[tile.WallType] && Main.tileDungeon[tile.TileType]) @@ -4491,24 +4495,25 @@ namespace CalamityMod.CalPlayer teleportStartY = foundY; } + int attempts = 25; - int rangeX = 100; - int rangeY = 200; - int randomFluff = 60; + int rangeX = 50; + int rangeY = 50; + int randomFluff = 20; Point finalTeleportPoint = Point.Zero; for (int i = 0; i < attempts; i++) { - for (int x = -rangeX; x <= rangeX; x++) + for (int x = 0; x <= rangeX; x++) { for (int y = 0; y <= rangeY; y++) { - int teleportPosX = teleportStartX + x + Main.rand.Next(-randomFluff, randomFluff); - int teleportPosY = teleportStartY + y + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosX = teleportStartX + (dungeonOnRightSide ? -x : x) + Main.rand.Next(-randomFluff, randomFluff); + int teleportPosY = teleportStartY - y + Main.rand.Next(-randomFluff, randomFluff); Tile tile = Framing.GetTileSafely(teleportPosX, teleportPosY); Tile tileAbove = Framing.GetTileSafely(teleportPosX, teleportPosY - 1); Tile tileBelow = Framing.GetTileSafely(teleportPosX, teleportPosY + 1); - if (!tileAbove.HasTile && tileBelow.HasUnactuatedTile && Main.wallDungeon[tile.WallType]) + if (!tileAbove.HasTile && WorldGen.ActiveAndWalkableTile(tileBelow.X(), tileBelow.Y()) && Main.tileDungeon[tile.TileType] && Main.wallDungeon[tile.WallType]) { finalTeleportPoint = new(tile.X(), tile.Y()); if (!Collision.SolidCollision(finalTeleportPoint.ToWorldCoordinates(), player.width, player.height)) @@ -5107,7 +5112,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; ++l) { int buffID = Player.buffType[l]; - if ((BuffDatasets.DebuffDataset[buffID] != null && BuffDatasets.DebuffDataset[buffID].AlcoholLevel > 0) || buffID == BuffID.Tipsy) + if ((CalamityBuffSets.DebuffDataset[buffID] != null && CalamityBuffSets.DebuffDataset[buffID].AlcoholLevel > 0) || buffID == BuffID.Tipsy) { Player.buffTime[l]++; } @@ -5474,7 +5479,6 @@ namespace CalamityMod.CalPlayer if (!Player.mount.Active) { float runAccMult = 1f + - (victideBurrowHead ? VictideHeadBurrow.MoveSpeedAccelerationBoost : 0f) + (lunicCorpsLegs ? LunicCorpsBoots.MoveSpeedAccelerationBoost : 0f) + (shadowSpeed ? DemonshadeGreaves.AccelerationBoost : 0f) + (stressPills ? 0.05f : 0f) + @@ -5495,7 +5499,6 @@ namespace CalamityMod.CalPlayer (hasteLevel * 0.05f); float runSpeedMult = 1f + - (victideBurrowHead ? VictideHeadBurrow.MoveSpeedAccelerationBoost : 0f) + (lunicCorpsLegs ? LunicCorpsBoots.MoveSpeedAccelerationBoost : 0f) + (shadowSpeed ? DemonshadeGreaves.AccelerationBoost : 0f) + (stressPills ? 0.05f : 0f) + @@ -5525,12 +5528,6 @@ namespace CalamityMod.CalPlayer else momentumCapacitorBoost = 0f; - if (victideBarrierHead) - { - Player.runAcceleration *= VictideHeadBarrier.RunAccelerationMult; - Player.runSlowdown *= VictideHeadBarrier.RunAccelerationMult; - } - Player.runAcceleration *= runAccMult; Player.maxRunSpeed *= runSpeedMult; } @@ -6403,6 +6400,9 @@ namespace CalamityMod.CalPlayer if (it.type == ItemType()) playerUsingWeapon = false; + if (it.type == ItemType()) + playerUsingWeapon = false; + // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. // "Clockwork" weapons can chain-fire multiple stealth strikes (really only 2 max) until you run out of stealth. bool animationCheck = it.useAnimation == it.useTime diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 538ffc89ef..76b0224e0f 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) { @@ -589,16 +582,6 @@ namespace CalamityMod.CalPlayer WindChilled.DrawEffects(drawInfo); #endregion - if (calamityPlayer.fortunesFavor && drawInfo.shadow == 0f) - { - if (Main.rand.NextBool(12)) - { - Vector2 plusPos = new Vector2(Player.position.X + Main.rand.NextFloat(-8f, 20f), Player.position.Y + Main.rand.NextFloat(-14f, 36f)); - - Particle Plus = new HealingPlus(plusPos, Main.rand.NextFloat(0.33f, 0.66f), new Vector2(0, Main.rand.NextFloat(-2f, -3.5f)) + Player.velocity, Color.Gold, Color.Goldenrod, Main.rand.Next(9, 13)); - GeneralParticleHandler.SpawnParticle(Plus); - } - } if (calamityPlayer.PinkJellyRegen && drawInfo.shadow == 0f) { if (Main.rand.NextBool(24)) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 3b4064ccb5..c8d9deee3a 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; } @@ -330,7 +326,7 @@ namespace CalamityMod.CalPlayer // Lower chance of Spadefish in Hardmode if (underground) // Underground { - int chance = Main.hardMode ? 10 : 2; + int chance = Main.hardMode ? 10 : 4; if (attempt.veryrare && Main.rand.NextBool(chance)) { itemDrop = ModContent.ItemType(); @@ -370,14 +366,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 +399,7 @@ namespace CalamityMod.CalPlayer else if (Main.rand.NextBool()) // 50% chance the common fish is replaced with driftwood itemDrop = ModContent.ItemType(); else - itemDrop = commonCatch; + itemDrop = ModContent.ItemType(); return; } // There is no complete fishing pool here, so most of it is vanilla default diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 7b29d85003..4bfc5a2325 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -43,6 +43,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,17 +283,11 @@ namespace CalamityMod.CalPlayer // Custom Death Messages + #region DoT Sources if (damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { - if (fishStocks && fishStockPower < 0) - { - string year = DateTime.Now.ToString("yy"); - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.FishStocks" + Main.rand.Next(1, 6 + 1)).ToNetworkText(Player.name, year)); - } if (alcoholPoisoning) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholBig" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (vHex) { // Unique messages appear half the time during each individual stage of SCal's fight @@ -314,13 +309,9 @@ namespace CalamityMod.CalPlayer damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText(vHexKeyToUse).ToNetworkText(Player.name)); } if (ZoneCalamity && Player.lavaWet) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SearingLava" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); - } if (godSlayerInferno) - { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.GodSlayerInferno" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); - } if (sulphurPoison) { if (!Main.rand.NextBool(4)) // 75% custom @@ -329,116 +320,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 @@ -446,6 +397,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)); @@ -454,6 +406,7 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.UltracosmicMaelstrom" + Main.rand.Next(1, 3)).ToNetworkText(Player.name)); } + } } if (NPC.AnyNPCs(ModContent.NPCType())) @@ -461,6 +414,11 @@ namespace CalamityMod.CalPlayer if (sCalDeathCount < 51) sCalDeathCount++; } + #endregion + + // Leon Death Noise RE4 + if (Main.zenithWorld) + SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); return true; } @@ -502,7 +460,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++; } @@ -727,70 +685,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) @@ -1223,8 +1121,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; } } @@ -1732,23 +1628,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; @@ -2202,12 +2081,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); @@ -2511,19 +2384,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) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 002fa8447a..53083cfb9e 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -198,18 +198,18 @@ namespace CalamityMod.CalPlayer int buff = Player.buffType[l]; if (buff <= 0) continue; - var data = BuffDatasets.DebuffDataset[buff]; + var data = CalamityBuffSets.DebuffDataset[buff]; if (data?.AlcoholLevel > 0) alcoholPoisonLevel += data.AlcoholLevel; } if (dripPlayer.ivDripEquipped && dripPlayer.currentAlcohol != AlcoholType.None) { - int ivBuffID = BuffDatasets.GetBuffIDFromAlcoholType(dripPlayer.currentAlcohol); + int ivBuffID = CalamityBuffSets.GetBuffIDFromAlcoholType(dripPlayer.currentAlcohol); if (ivBuffID != -1) { - var ivData = BuffDatasets.DebuffDataset[ivBuffID]; + var ivData = CalamityBuffSets.DebuffDataset[ivBuffID]; if (ivData?.AlcoholLevel > 0) alcoholPoisonLevel += ivData.AlcoholLevel; } @@ -338,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) @@ -493,9 +493,6 @@ namespace CalamityMod.CalPlayer if (sRegen) Player.lifeRegen += SpiritGlyph.RegenBoost; - if (fortunesFavor) - Player.lifeRegen += FortunesFavor.FortunesFavorRegenBoost; - if (PinkJellyRegen) Player.lifeRegen += LifeJelly.AuraRegenBoost; @@ -588,9 +585,8 @@ namespace CalamityMod.CalPlayer if (community) { int regenBoost = 1 + (int)(TheCommunity.CalculatePower() * TheCommunity.RegenMultiplier); - bool lesserEffect = Player.buffType.Any(i => BuffDatasets.DebuffDataset[i] is not null && BuffDatasets.DebuffDataset[i].AlcoholLevel > 0); if (Player.lifeRegen < 0) - Player.lifeRegen += lesserEffect ? 1 : regenBoost; + Player.lifeRegen += regenBoost; } if (manaOverloader) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index d928a64c18..520441dac6 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -908,6 +908,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; @@ -944,11 +949,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 @@ -976,14 +976,17 @@ namespace CalamityMod.CalPlayer } } - if (Player.sitting.TryGetSittingBlock(Player, out Tile AuricToiletTile)) + if (Player.sitting.TryGetSittingBlock(Player, out Tile AuricToiletTile) && !rejectionImmunity) { - 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; + 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() @@ -1718,6 +1721,7 @@ namespace CalamityMod.CalPlayer fishStockOldPower.Item2, fishStockOldPower.Item3, fishStockOldPower.Item4); + fishStockPower = newFishStockPower; } // Stats Player.GetDamage() += 0.15f * fishStockPower; @@ -2391,7 +2395,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; @@ -2549,13 +2553,6 @@ namespace CalamityMod.CalPlayer else flameLickedShellParry--; } - if (shieldOfTheOceanParry > 0) - { - if (shieldOfTheOcean) - ShieldoftheOcean.HandleParryCountdown(Player); - else - shieldOfTheOceanParry--; - } if (!flameLickedShell && flameLickedShellParry > 0) flameLickedShellParry--; @@ -3224,7 +3221,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; @@ -3747,10 +3744,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; - } } } } @@ -3847,7 +3841,7 @@ namespace CalamityMod.CalPlayer Player.lifeMagnet = true; if (whisperingDeath && !laudanum) - Player.GetDamage() -= 0.2f; + Player.GetDamage() -= WhisperingDeath.PlayerDamageReduction; if (armorCrunch && !laudanum) { @@ -3863,7 +3857,7 @@ namespace CalamityMod.CalPlayer if (eutrophication) Player.velocity = Vector2.Zero; - if (vaporfied || galvanicCorrosion) + if (vaporfied || galvanicCorrosion || windChilled) Player.velocity *= 0.98f; if (molluskHelmet) @@ -4460,7 +4454,7 @@ namespace CalamityMod.CalPlayer else if (hasBuff == ModContent.BuffType()) { Player.lifeRegenCount += 5; - Player.GetDamage() += 0.2f; + Player.GetDamage() += WhisperingDeath.PlayerDamageReduction; } switch (hasBuff) @@ -4986,6 +4980,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 2861e37bc3..979cee740d 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -212,6 +212,11 @@ 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) { @@ -456,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); @@ -1226,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); @@ -1289,7 +1298,7 @@ namespace CalamityMod.CalPlayer //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/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/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/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index 2a70fe931f..ab27f901aa 100644 --- a/DataStructures/DebuffData.cs +++ b/DataStructures/DebuffData.cs @@ -1,7 +1,6 @@ using System; -using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Accessories; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,88 +8,6 @@ using Terraria.ModLoader; namespace CalamityMod.DataStructures { - [ReinitializeDuringResizeArrays] - public static class BuffDatasets - { - private static DebuffData Alch(int level) => new DebuffData() { AlcoholLevel = level }; - 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, - - BuffID.Tipsy, Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - ModContent.BuffType(), Alch(1), - - ModContent.BuffType(), Alch(2), - ModContent.BuffType(), Alch(3) - ); - public static int GetBuffIDFromAlcoholType(AlcoholType type) - { - return type switch - { - AlcoholType.BaconOil => ModContent.BuffType(), - AlcoholType.BloodyMary => ModContent.BuffType(), - AlcoholType.CaribbeanRum => ModContent.BuffType(), - AlcoholType.CinnamonRoll => ModContent.BuffType(), - AlcoholType.Everclear => ModContent.BuffType(), - AlcoholType.EvergreenGin => ModContent.BuffType(), - AlcoholType.Fireball => ModContent.BuffType(), - AlcoholType.GrapeBeer => ModContent.BuffType(), - AlcoholType.Manhattan => ModContent.BuffType(), - AlcoholType.Margarita => ModContent.BuffType(), - AlcoholType.Moonshine => ModContent.BuffType(), - AlcoholType.MoscowMule => ModContent.BuffType(), - AlcoholType.OldFashioned => ModContent.BuffType(), - AlcoholType.PurpleHaze => ModContent.BuffType(), - AlcoholType.RedWine => ModContent.BuffType(), - AlcoholType.Rum => ModContent.BuffType(), - AlcoholType.Screwdriver => ModContent.BuffType(), - AlcoholType.StarBeamRye => ModContent.BuffType(), - AlcoholType.Tequila => ModContent.BuffType(), - AlcoholType.TequilaSunrise => ModContent.BuffType(), - AlcoholType.Vodka => ModContent.BuffType(), - AlcoholType.Whiskey => ModContent.BuffType(), - AlcoholType.WhiteWine => ModContent.BuffType(), - - // Vanilla treats both Ale and Sake as the "Tipsy" buff - AlcoholType.Ale => BuffID.Tipsy, - AlcoholType.Sake => BuffID.Tipsy, - - _ => -1 - }; - } - } public class DebuffData { /// @@ -239,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; @@ -254,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; } @@ -267,7 +184,7 @@ namespace CalamityMod.DataStructures /// public void DefaultUpdateOnPlayer(Player player, int buffType, ref int buffIndex, ref int damage) { - + } /// @@ -292,13 +209,13 @@ namespace CalamityMod.DataStructures //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 @@ -360,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; @@ -373,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 @@ -501,5 +418,38 @@ 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) + { + bool hasVanillaOil = npc.onFrostBurn || npc.onFrostBurn2 || npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; + if (hasVanillaOil) + npc.lifeRegen -= Oiled.EnemyVanillaRegenToCancelOut; + Oiled.NPCLifeRegenMethod(npc, BuffID.Oiled, ref index, ref dmg); + } + + debuffData.NPCLifeRegenMethod(npc, type, ref index, ref dmg); + + int done = npc.lifeRegen; + npc.lifeRegen = oldRegen; + npc.lifeRegenCount = oldCount; + return done; + } + + #endregion } } 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 0e06aeef01..7bda59d4a4 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -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 @@ -513,6 +525,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/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/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/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 324678faa4..086b566167 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -850,5 +850,39 @@ namespace CalamityMod.ILEditing }); } #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 a4463dddb6..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,6 +103,7 @@ 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; @@ -153,8 +153,6 @@ namespace CalamityMod.ILEditing IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; - IL_Projectile.AI_061_FishingBobber += WhitelistVictideBobber; - On_Player.ItemCheck_CheckFishingBobbers += PreventVictideBobberFromJamming; IL_Projectile.CanExplodeTile += MakeMeteoriteExplodable; IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 775374dc21..f7466891f6 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1653,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 3c04413d31..c2674dcadc 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -318,59 +318,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Allow Victide Bobber to Exist - private static void WhitelistVictideBobber(ILContext il) - { - var cursor = new ILCursor(il); - - // Find the label which skips the "flag = true" that kills the projectile - ILLabel flagStorage = null; - if (!cursor.TryGotoNext(MoveType.After, x => x.MatchBeq(out flagStorage))) - { - LogFailure("Allow Victide Bobber to Exist", "Failed to properly navigate label to direct to"); - return; - } - - // Properly perform the skip if the projectile type is the Victide Bobber - cursor.Emit(OpCodes.Ldarg_0); - cursor.Emit(OpCodes.Ldfld, typeof(Projectile).GetField("type")); - cursor.Emit(OpCodes.Ldc_I4, ModContent.ProjectileType()); - cursor.Emit(OpCodes.Beq_S, flagStorage); - } - #endregion - - #region Prevent Victide Bobber from Jammming - private static bool PreventVictideBobberFromJamming(On_Player.orig_ItemCheck_CheckFishingBobbers orig, Player self, bool canUse) - { - // Run through the original stuff - canUse = orig(self, canUse); - - int bobberCount = 0; - foreach (Projectile proj in Main.ActiveProjectiles) - { - if (proj.active && proj.owner == self.whoAmI && proj.bobber) - { - bobberCount++; - if (proj.type == ModContent.ProjectileType()) - { - // Go back to casting if there's nothing loaded - if (proj.ai[1] == 0f) - proj.ai[0] = 0f; - - // Allow you to still use the fishing rod - canUse = true; - } - } - } - - // Unless.. you have a bobber already that's NOT Victide, then back to disabling - if (canUse && bobberCount > 1) - canUse = false; - - return canUse; - } - #endregion - #region Prevent UFO Mount from Dismounting in Water private static void PreventUFODismountInWater(ILContext il) { 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/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/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/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/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/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 50d9ae909a..0a3073ee10 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int soulDamage => 15; + public static int soulDamage => 20; public override void SetDefaults() { Item.width = 28; diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 3a270de644..e317f2a6d6 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; 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/FishStocks.cs b/Items/Accessories/FishStocks.cs index a5fab55a28..a3215a46e0 100644 --- a/Items/Accessories/FishStocks.cs +++ b/Items/Accessories/FishStocks.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.value = Item.buyPrice(gold: 7, silver: 77); // Sold by Shady Salesman Item.rare = ItemRarityID.Blue; Item.accessory = true; } + public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().fishStocks = true; diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 3b47623fee..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/FrozenCube.cs b/Items/Accessories/FrozenCube.cs index 6cd386972d..de230c812f 100644 --- a/Items/Accessories/FrozenCube.cs +++ b/Items/Accessories/FrozenCube.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -31,10 +32,20 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 34; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 15); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundFrozenCube) + { + RecipeUnlockHandler.HasFoundFrozenCube = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -48,6 +59,20 @@ namespace CalamityMod.Items.Accessories Projectile.NewProjectileDirect(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 = 0; + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI); + } + } + public override void ModifyTooltips(List list) { if (Main.LocalPlayer != null) diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index 8f020a1998..2e63782920 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +13,20 @@ namespace CalamityMod.Items.Accessories { Item.width = 38; Item.height = 36; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 15); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundFungalSymbiote) + { + RecipeUnlockHandler.HasFoundFungalSymbiote = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index 7852f765ac..ca2d1cce36 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -7,7 +7,6 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [LegacyName("AmidiasPendant")] public class GiantPearl : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 104e8933bc..6d2e3c4338 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,10 +13,18 @@ namespace CalamityMod.Items.Accessories { Item.width = 48; Item.height = 54; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 25); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundGladiatorsLocket) + { + RecipeUnlockHandler.HasFoundGladiatorsLocket = true; + CalamityNetcode.SyncWorld(); + } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/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 3f22fbf8c0..977f8ed488 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() diff --git a/Items/Accessories/IVDripOnTheRocks.cs b/Items/Accessories/IVDripOnTheRocks.cs index dd58c8f289..d934e91c64 100644 --- a/Items/Accessories/IVDripOnTheRocks.cs +++ b/Items/Accessories/IVDripOnTheRocks.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using Terraria.UI; namespace CalamityMod.Items.Accessories @@ -81,6 +83,34 @@ namespace CalamityMod.Items.Accessories On_ItemSlot.OverrideLeftClick -= IvDripAlcoholEquip; } + public override void SaveData(TagCompound tag) + { + tag["ContainedAlcoholID"] = containedAlcoholID; + tag["CurrentAlcoholType"] = (int)currentAlcoholType; + } + + public override void LoadData(TagCompound tag) + { + containedAlcoholID = tag.GetInt("ContainedAlcoholID"); + + if (tag.ContainsKey("CurrentAlcoholType")) + currentAlcoholType = (AlcoholType)tag.GetInt("CurrentAlcoholType"); + else + currentAlcoholType = AlcoholType.None; + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(containedAlcoholID); + writer.Write((int)currentAlcoholType); + } + + public override void NetReceive(BinaryReader reader) + { + containedAlcoholID = reader.ReadInt32(); + currentAlcoholType = (AlcoholType)reader.ReadInt32(); + } + private bool IvDripAlcoholEquip(On_ItemSlot.orig_OverrideLeftClick orig, Item[] inv, int context, int slot) { if (context == ItemSlot.Context.InventoryItem || context == ItemSlot.Context.ChestItem) diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs index a10d8a46be..1bd9c524fb 100644 --- a/Items/Accessories/JellyChargedBattery.cs +++ b/Items/Accessories/JellyChargedBattery.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Accessories public class JellyChargedBattery : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 716d7a8cf2..3ba0a52e6f 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -12,19 +12,13 @@ namespace CalamityMod.Items.Accessories public Color? TooltipExtensionColor => new(195, 223, 255); - public override void SetStaticDefaults() - { - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.accessory = true; - Item.SetRevExclusive(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 8f9a198dee..acb8755aab 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int ambergrisDashDamage => 350; public static float DashSpeedIncrease => 1f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index d051683737..c2aed99046 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -31,10 +32,18 @@ namespace CalamityMod.Items.Accessories { Item.width = 66; Item.height = 46; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 15); // Sold by Shady Salesman Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundLuxorsGift) + { + RecipeUnlockHandler.HasFoundLuxorsGift = true; + CalamityNetcode.SyncWorld(); + } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 7033bda892..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..cf8c623f47 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() 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..fe448ea569 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() { 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/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..981a849630 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; 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/SpringStool.cs b/Items/Accessories/SpringStool.cs index e68a6b1687..1b3f15a6b0 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)) { 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/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/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..8acc1c7521 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; @@ -20,11 +21,20 @@ namespace CalamityMod.Items.Accessories { Item.width = 34; Item.height = 32; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + 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/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/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..4de3c063c4 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; 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/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/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 76456d1b89..19435bdd7d 100644 --- a/Items/Armor/Aerospec/AerospecHeadMagic.cs +++ b/Items/Armor/Aerospec/AerospecHeadMagic.cs @@ -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/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/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/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/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/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index fafb628137..d70f62349e 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -479,6 +479,21 @@ namespace CalamityMod.Items } } } + if (modPlayer.victideSet) + { + if ((item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass() || + item.CountsAsClass() || item.CountsAsClass()) && + Main.rand.NextBool(10) && !item.channel) + { + if (player.whoAmI == Main.myPlayer) + { + // Victide All-class Seashells: 200%, soft cap starts at 46 base damage + int seashellDamage = CalamityUtils.DamageSoftCap(damage * 2, 46); + + Projectile.NewProjectile(source, position, velocity * 1.25f, ModContent.ProjectileType(), seashellDamage, 1f, player.whoAmI); + } + } + } return true; } @@ -718,10 +733,6 @@ namespace CalamityMod.Items if (PopupGUIManager.AnyGUIsActive) return false; - // Can't use anything while burrowing - if (player.ownedProjectileCounts[ProjectileType()] > 0) - return false; - if (player.ownedProjectileCounts[ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { @@ -1196,6 +1207,7 @@ namespace CalamityMod.Items if (item.type == ItemID.GravityGlobe) { + player.noFallDmg = true; player.GetJumpState().Enable(); if (player.Calamity().justChangedGravity) { @@ -1333,8 +1345,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]) @@ -1434,8 +1444,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 863e95c498..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,9 +169,11 @@ namespace CalamityMod.Items float cdmg = 2f + Main.LocalPlayer.Calamity().critDamage + Main.LocalPlayer.GetTotalCritChance(item.DamageType) * 0.02f; tooltips.FirstOrDefault(x => x.Name == "CritChance")!.Text = CalamityUtils.GetText("Common.CritDamageTootip").Format(cdmg.ToPercent()); } - + //Add "Uses X Minion Slots right above "Uses X Mana" - if (ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 || ContentSamples.ProjectilesByType[item.shoot].minionSlots > 0) + //Solutions set their "shoot" to 145 less than the projectile id of the spray, effectively making them a COMPLETELY RANDOM projectile that would change based on the folder structure of the mod. + //So, we must blacklist solutions from the item.shoot check. + if (ItemID.Sets.StaffMinionSlotsRequired[item.type] > 1 || (item.ammo != AmmoID.Solution && ContentSamples.ProjectilesByType[item.shoot].minionSlots > 0)) { float cost = ItemID.Sets.StaffMinionSlotsRequired[item.type]; if (item.type == ModContent.ItemType() && Main.LocalPlayer.Calamity().fadedIdolatry) @@ -322,6 +324,22 @@ namespace CalamityMod.Items } } + foreach (var buffID in CalamityItemSets.ExtraDebuffTooltip_Enemy[item.type]) + { + if (!buffIdsInTooltip.ContainsKey(buffID)) + buffIdsInTooltip.Add(buffID, 0); + else if (buffIdsInTooltip[buffID] == 1) + buffIdsInTooltip[buffID] = 2; + } + foreach (var buffID in CalamityItemSets.ExtraDebuffTooltip_Player[item.type]) + { + if (!buffIdsInTooltip.ContainsKey(buffID)) + buffIdsInTooltip.Add(buffID, 1); + else if (buffIdsInTooltip[buffID] == 0) + buffIdsInTooltip[buffID] = 2; + + } + if (buffIdsInTooltip.Count > 0) { bool showTheTip = false; @@ -526,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(); @@ -664,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) @@ -735,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) @@ -1078,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) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 6b32dc8db6..9ed8e64673 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -41,19 +41,18 @@ 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(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)) }, // VANILLA: 9 DMG - { ItemID.BeeKeeper, Do(UseTurn, DamageExact(32)) }, // VANILLA: 30 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 @@ -63,22 +62,22 @@ namespace CalamityMod.Items { 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.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 @@ -89,11 +88,9 @@ 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)) }, // Aerial Bane. VANILLA: 39 DMG. Compensation for removing aerial multiplier { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon. VANILLA: 180 DMG @@ -105,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.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)) }, // 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 @@ -143,7 +140,7 @@ 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)) }, // VANILLA: 29 DMG @@ -156,7 +153,7 @@ namespace CalamityMod.Items { 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)) }, // VANILLA: 40 DMG - { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) }, // VANILLA: 200 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 @@ -166,7 +163,6 @@ 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 @@ -179,11 +175,11 @@ namespace CalamityMod.Items { 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 @@ -232,14 +228,13 @@ namespace CalamityMod.Items { 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 @@ -249,15 +244,14 @@ 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)) }, // 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 @@ -388,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 }, @@ -404,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/TrustyOldRod.cs b/Items/Fishing/FishingRods/TrustyOldRod.cs index 2f77e5458c..d19e2a3b81 100644 --- a/Items/Fishing/FishingRods/TrustyOldRod.cs +++ b/Items/Fishing/FishingRods/TrustyOldRod.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 35); // Same price as Sitting Duck's Fishing Pole; Sold by Shady Salesman } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) { diff --git a/Items/Fishing/RageBait.cs b/Items/Fishing/RageBait.cs index 43c2ac8f62..22f1d68c6a 100644 --- a/Items/Fishing/RageBait.cs +++ b/Items/Fishing/RageBait.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Fishing Item.height = 12; Item.maxStack = Item.CommonMaxStack; Item.rare = ItemRarityID.Blue; - Item.value = Item.sellPrice(copper: 1); + Item.value = Item.buyPrice(silver: 15); // Sold by Shady Salesman Item.bait = 100; Item.consumable = true; } diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs 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..87e8d5a6fb 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/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/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/Pets/IronBall.cs b/Items/Pets/IronBall.cs new file mode 100644 index 0000000000..d30b185c3d --- /dev/null +++ b/Items/Pets/IronBall.cs @@ -0,0 +1,30 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class IronBall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Pets"; + public override void SetDefaults() + { + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.UseSound = SoundID.NPCHit4; + Item.value = Item.sellPrice(gold: 2); + Item.rare = ItemRarityID.Orange; + Item.Calamity().donorItem = true; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(Item.buffType, 15, true); + } + } + } +} diff --git a/Items/Pets/IronBall.png b/Items/Pets/IronBall.png new file mode 100644 index 0000000000..5987ebb2e1 Binary files /dev/null and b/Items/Pets/IronBall.png differ diff --git a/Items/Placeables/Banners/BabyGhostBellBanner.png b/Items/Placeables/Banners/BabyGhostBellBanner.png index 28922c83c1..6c1997b3b2 100644 Binary files a/Items/Placeables/Banners/BabyGhostBellBanner.png and b/Items/Placeables/Banners/BabyGhostBellBanner.png differ diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs new file mode 100644 index 0000000000..a8cd03e747 --- /dev/null +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class BlindedAnglerBanner : BaseBanner + { + public override int BannerTileStyle => 104; + } +} diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.png b/Items/Placeables/Banners/BlindedAnglerBanner.png new file mode 100644 index 0000000000..6f56ac9128 Binary files /dev/null and b/Items/Placeables/Banners/BlindedAnglerBanner.png differ diff --git a/Items/Placeables/Banners/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..d7ba8c6e67 100644 Binary files a/Items/Placeables/Furniture/CorruptionEffigy.png and b/Items/Placeables/Furniture/CorruptionEffigy.png differ 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/ForgottenNobleStatue.cs b/Items/Placeables/Furniture/ForgottenNobleStatue.cs deleted file mode 100644 index 7146286838..0000000000 --- a/Items/Placeables/Furniture/ForgottenNobleStatue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class ForgottenNobleStatue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 60; - Item.height = 108; - } - } -} diff --git a/Items/Placeables/Furniture/ForgottenNobleStatue.png b/Items/Placeables/Furniture/ForgottenNobleStatue.png deleted file mode 100644 index f4f6ac7aa1..0000000000 Binary files a/Items/Placeables/Furniture/ForgottenNobleStatue.png and /dev/null differ diff --git a/Items/Placeables/Furniture/ForgottenScholarStatue.cs b/Items/Placeables/Furniture/ForgottenScholarStatue.cs deleted file mode 100644 index d3acfb2e55..0000000000 --- a/Items/Placeables/Furniture/ForgottenScholarStatue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class ForgottenScholarStatue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 56; - Item.height = 96; - } - } -} diff --git a/Items/Placeables/Furniture/ForgottenScholarStatue.png b/Items/Placeables/Furniture/ForgottenScholarStatue.png deleted file mode 100644 index 7e27c89408..0000000000 Binary files a/Items/Placeables/Furniture/ForgottenScholarStatue.png and /dev/null differ diff --git a/Items/Placeables/Furniture/GluttonyBlender.cs b/Items/Placeables/Furniture/GluttonyBlender.cs index 86a53a4691..ff5ef494cf 100644 --- a/Items/Placeables/Furniture/GluttonyBlender.cs +++ b/Items/Placeables/Furniture/GluttonyBlender.cs @@ -1,4 +1,5 @@ -using CalamityMod.Tiles.Furniture; +using CalamityMod.Items.Fishing; +using CalamityMod.Tiles.Furniture; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,13 +11,12 @@ namespace CalamityMod.Items.Placeables.Furniture public class GluttonyBlender : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public const int OneInXChanceForGoodSlop = 5; public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.rare = ItemRarityID.Orange; - Item.value = Item.buyPrice(gold: 5); + Item.value = Item.buyPrice(gold: 10); // Sold by Shady Salesman } } @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - Item.DefaultToFood(32, 30, BuffID.WellFed3, CalamityUtils.MinutesToFrames(60)); + Item.DefaultToFood(32, 30, BuffID.WellFed3, CalamityUtils.MinutesToFrames(30)); Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Orange; } @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { - ItemID.Sets.ExtractinatorMode[Type] = ItemID.OldShoe; + ItemID.Sets.ExtractinatorMode[Type] = Type; } public override void SetDefaults() { @@ -63,5 +63,27 @@ namespace CalamityMod.Items.Placeables.Furniture Item.rare = ItemRarityID.Gray; Item.MakeUsableWithChlorophyteExtractinator(); } + + public override void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) + { + float dropRand = Main.rand.NextFloat(); + resultStack = 1; + + // 50% chance for Poo + // 25% chance for Clay Block + // 15% chance for Apprentice Bait + // 7.5% chance for Grasshopper + // 2.5% chance for Rage Bait + if (dropRand < 0.025f) + resultType = ModContent.ItemType(); + else if (dropRand < 0.1f) + resultType = ItemID.Grasshopper; + else if (dropRand < 0.25f) + resultType = ItemID.ApprenticeBait; + else if (dropRand < 0.5f) + resultType = ItemID.ClayBlock; + else + resultType = ItemID.PoopBlock; + } } } diff --git a/Items/Placeables/Furniture/OtonilouStatue.cs b/Items/Placeables/Furniture/OtonilouStatue.cs deleted file mode 100644 index b9945b3676..0000000000 --- a/Items/Placeables/Furniture/OtonilouStatue.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CalamityMod.Tiles.Furniture; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class OtonilouStatue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 214; - Item.height = 414; - } - } -} diff --git a/Items/Placeables/Furniture/OtonilouStatue.png b/Items/Placeables/Furniture/OtonilouStatue.png deleted file mode 100644 index 0142502af3..0000000000 Binary files a/Items/Placeables/Furniture/OtonilouStatue.png and /dev/null differ diff --git a/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs b/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs deleted file mode 100644 index e0225466c7..0000000000 --- a/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs +++ /dev/null @@ -1,19 +0,0 @@ -using CalamityMod.Tiles.Furniture.Paintings; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture.Paintings -{ - public class AmidiasPainting : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.width = 52; - Item.height = 34; - Item.value = Item.buyPrice(gold: 1); - } - } -} diff --git a/Items/Placeables/Furniture/Paintings/AmidiasPainting.png b/Items/Placeables/Furniture/Paintings/AmidiasPainting.png deleted file mode 100644 index 2d555e093f..0000000000 Binary files a/Items/Placeables/Furniture/Paintings/AmidiasPainting.png and /dev/null differ diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index cfaef17681..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,34 +24,42 @@ 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", @@ -69,6 +79,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Fluffy", "fryzahh", "Gpscorpion", + "Hugekraken", "jasper", "LordMetarex", "Moonburn", @@ -85,8 +96,11 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "TYESKI", "Xyk", "YuH", - // Former devs - "Afzofa", + }; + + public static IList formerDevList = new List() + { + "Afzofa", "AdipemDragon", "Akeeli", "Aleksh", @@ -130,7 +144,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Grox the Great", "Heart Plus Up!", "Hectique", - "Hugekraken", "Huggles", "Ian-1KV", "IbanPlay", diff --git a/Items/Placeables/Furniture/PiggyCage.png b/Items/Placeables/Furniture/PiggyCage.png index 80435d34b5..773901f3b5 100644 Binary files a/Items/Placeables/Furniture/PiggyCage.png and b/Items/Placeables/Furniture/PiggyCage.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/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 index 4f57836dea..e852c856fa 100644 --- a/Items/Placeables/Furniture/TheMonument.cs +++ b/Items/Placeables/Furniture/TheMonument.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.Furniture Item.width = 40; Item.height = 50; Item.rare = ItemRarityID.Pink; - Item.value = Item.buyPrice(gold: 5); + Item.value = Item.buyPrice(platinum: 1); // Sold by Shady Salesman } public override void Load() diff --git a/Items/Placeables/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/GreedPot.cs b/Items/Placeables/GreedPot.cs index 0ad723196e..e773c46424 100644 --- a/Items/Placeables/GreedPot.cs +++ b/Items/Placeables/GreedPot.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Tiles; namespace CalamityMod.Items.Placeables { @@ -12,7 +9,11 @@ namespace CalamityMod.Items.Placeables { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); - + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.rare = ItemRarityID.Pink; + Item.value = Item.buyPrice(gold: 5); // Sold by Shady Salesman + } } } diff --git a/Items/Placeables/Pylons/CragsPylon.cs b/Items/Placeables/Pylons/CragsPylon.cs index 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 index d3b20577ee..96704a3bc2 100644 --- a/Items/Potions/Alcohol/BaconOil.cs +++ b/Items/Potions/Alcohol/BaconOil.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - Item.value = Item.sellPrice(silver: 2); + Item.value = Item.buyPrice(silver: 30); // Sold by Shady Salesman Item.rare = ItemRarityID.Blue; } diff --git a/Items/Potions/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/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/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/TheSandwich.cs b/Items/Potions/Food/TheSandwich.cs index f99710a8c7..6d1128ef0e 100644 --- a/Items/Potions/Food/TheSandwich.cs +++ b/Items/Potions/Food/TheSandwich.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Potions.Food public override void SetDefaults() { Item.DefaultToFood(70, 48, ModContent.BuffType(), CalamityUtils.MinutesToFrames(10)); - Item.value = Item.sellPrice(silver: 20); + Item.value = Item.buyPrice(silver: 55); // Same price as Pad Thai; Sold by Shady Salesman Item.rare = ItemRarityID.Blue; } public override void UseAnimation(Player player) diff --git a/Items/Potions/TheConcoction.cs b/Items/Potions/TheConcoction.cs index 0c9ebf0c0c..581eb2bdd3 100644 --- a/Items/Potions/TheConcoction.cs +++ b/Items/Potions/TheConcoction.cs @@ -1,8 +1,11 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Rarities; +using CalamityMod.Scenes.MusicScenes; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,10 +17,8 @@ namespace CalamityMod.Items.Potions { public class TheConcoction : ModItem, ILocalizedModType { - private static int hoverTimer = 0; - private static bool wasHovering = false; public new string LocalizationCategory => "Items.Potions"; - + public static int healValue = 9999; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; @@ -28,41 +29,45 @@ namespace CalamityMod.Items.Potions new Color(246, 34, 79) }; } - public override void SetDefaults() { - Item.DefaultToHealingPotion(50, 56, 500); - Item.value = Item.sellPrice(silver: 60); + Item.UseSound = SoundID.Item3; + Item.useStyle = 9; + Item.useTurn = true; + Item.useAnimation = (Item.useTime = 17); + Item.maxStack = Item.CommonMaxStack; + Item.consumable = true; + Item.width = 50; + Item.height = 56; + Item.potion = true; + + Item.value = Item.buyPrice(gold: 1); // Sold by Shady Salesman Item.rare = ItemRarityID.Green; } - - + public override bool CanUseItem(Player player) + { + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); + return concoctionPlayer.swinesWrathCounter == -1; + } public override void OnConsumeItem(Player player) { - TheConcoctionPlayer cocPlayer = player.GetModPlayer(); - cocPlayer.swinesWrathCounter = 1200; // Creates a 10 second delay before the buff is visible (triggers at 600) + player.HealPlayer(TheConcoction.healValue); + SoundEngine.PlaySound(SoundID.Item3, player.Center); + TheConcoctionPlayer concoctionPlayer = player.GetModPlayer(); + concoctionPlayer.swinesWrathCounter = 1200; // Creates a 10 second delay before the buff is visible (triggers at 600) } - - public override void UpdateInventory(Player player) - { - wasHovering = Main.HoverItem?.type == Type; - } - - // Display different text for the first 10 frames of hovering over the item's tooltip. public override void ModifyTooltips(List tooltips) { - bool isHovering = Main.HoverItem?.type == Type; + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); - if (isHovering && !wasHovering) - hoverTimer = 0; - if (isHovering) - hoverTimer++; - - if (hoverTimer <= 10 && hoverTimer > 0) + if (concoctionPlayer.hoverTimer <= 10 && concoctionPlayer.hoverTimer > 0) { - TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "HealLife"); - healLine?.Text = this.GetLocalization("EasterEggText").Value; + TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (healLine != null) + { + healLine.Text = this.GetLocalization("EasterEggText").Value; + } } } } @@ -70,20 +75,64 @@ namespace CalamityMod.Items.Potions public class TheConcoctionPlayer : ModPlayer { public int swinesWrathCounter = -1; - + public int spamTimer = 0; + public bool holdingHeal = false; + + public int hoverTimer = 0; + public bool wasHovering = false; + public override void PostUpdate() { + if (!holdingHeal && Player.controlQuickHeal && spamTimer >= 0 && Player.InventoryHas(ModContent.ItemType())) + { + Vector2 vel = -Vector2.UnitY.RotatedByRandom(0.4f); + Particle chug = new CustomSpark(Player.Center + vel * 35, vel * Main.rand.NextFloat(2, 3), "CalamityMod/Items/Potions/TheConcoction", false, 22, 0.6f, Color.White, Vector2.One, false, false, 0, false, false, noShrink: true, spin: 0.01f * Math.Sign(vel.X)); + GeneralParticleHandler.SpawnParticle(chug); + SoundStyle tryChug = new("CalamityMod/Sounds/Custom/AbilitySounds/PotionSicknessOver"); + SoundEngine.PlaySound(tryChug with { pitch = Main.rand.NextFloat(0.6f, 0.8f), MaxInstances = -1 }, Player.Center); + spamTimer += 80; + if (spamTimer > 230) + spamTimer = 230; + holdingHeal = true; + } + if (!Player.controlQuickHeal) + holdingHeal = false; + if (spamTimer > 0) + spamTimer--; + if (spamTimer >= 180) + { + Player.ConsumeItem(ModContent.ItemType()); + swinesWrathCounter = 1200; + spamTimer = -1; + } + if (swinesWrathCounter > 0) { swinesWrathCounter--; - if (swinesWrathCounter <= 600 && !Player.HasBuff()) // When there is 10 seconds left + if (swinesWrathCounter <= 600 && !Player.HasBuff()) { Player.AddBuff(ModContent.BuffType(), 600); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/SwinesWrathProc"), Player.Center); } } + + if (Main.myPlayer == Player.whoAmI) + { + // Check if hover over the right item + bool isHovering = Main.HoverItem?.type == ModContent.ItemType(); + + if (isHovering && !wasHovering) + hoverTimer = 0; + + if (isHovering) + hoverTimer++; + else + hoverTimer = 0; + + // Save the state for the next frame + wasHovering = isHovering; + } } } } diff --git a/Items/Potions/TheElixir.cs b/Items/Potions/TheElixir.cs index 9a18138074..2200a67d6d 100644 --- a/Items/Potions/TheElixir.cs +++ b/Items/Potions/TheElixir.cs @@ -1,9 +1,12 @@ 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 @@ -24,9 +27,9 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.value = Item.sellPrice(silver: 2); - Item.rare = ItemRarityID.Blue; Item.DefaultToFood(28, 51, 0, 0, true); + Item.value = Item.buyPrice(silver: 10); // Sold by Shady Salesman + Item.rare = ItemRarityID.Blue; } // Player is unable to use the item when Chaos State is enabled to prevent spamming the item. @@ -42,70 +45,91 @@ namespace CalamityMod.Items.Potions public override bool? UseItem(Player player) { - if (player.whoAmI == Main.myPlayer) + // 25% chance to "fail" a teleport and send the player to one of three random dangerous locations. + if (Main.rand.NextBool(4)) { - if (Main.rand.NextBool(4)) + if (Main.netMode == NetmodeID.SinglePlayer) { - int roll = Main.rand.Next(3); - Vector2? location = roll switch - { - 1 => CalamityPlayer.GetAbyssVoidTeleportPosition(player), - 2 => CalamityPlayer.GetTempleTeleportPosition(player), - _ => CalamityPlayer.GetDungeonArchivesTeleportPosition(player) - }; - - if (!location.HasValue) - return false; + 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); - CalamityPlayer.ModTeleport(player, location.Value, false, TeleportationStyleID.RecallPotion); } - //If it doesn't fail, just act like a Potion of Return - else + } + //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 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++) { - 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; + if (Main.rand.NextBool(3)) + dust.velocity *= 0.75f; } - for (int k = 0; k < 70; k++) + if (Main.rand.NextBool(3)) { - 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; + dust.velocity *= 2f; + dust.scale *= 1.2f; } - SoundEngine.PlaySound(SoundID.Item6, player.Center); + 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/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 index c646795033..53a959ca3e 100644 --- a/Items/SummonItems/TownPets/TheHousingContract.cs +++ b/Items/SummonItems/TownPets/TheHousingContract.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.SummonItems.TownPets Item.width = 28; Item.height = 28; Item.maxStack = Item.CommonMaxStack; - Item.SetShopValues(ItemRarityColor.Green2, Item.buyPrice(0, 5)); + Item.SetShopValues(ItemRarityColor.Green2, Item.buyPrice(gold: 5)); // Same price as other Pet Licenses; Sold by Shady Salesman } public override bool? UseItem(Player player) diff --git a/Items/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/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/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/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/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 index 60e5aad77c..3e8f1f0324 100644 --- a/Items/Tools/TheGift.cs +++ b/Items/Tools/TheGift.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Tools public static readonly SoundStyle BadBuzzer = new SoundStyle("CalamityMod/Sounds/Custom/BadGiftBuzzer") with { Volume = 0.85f }; public override void SetDefaults() { - Item.width = Item.height = 20; + Item.width = 30; + Item.height = 20; Item.maxStack = Item.CommonMaxStack; Item.useTime = Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Swing; @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Tools Item.noMelee = true; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 5); // Sold by Shady Salesman Item.rare = ItemRarityID.Green; } @@ -94,7 +95,7 @@ namespace CalamityMod.Items.Tools orig(self, player, npc); // Immediately exit early if it's Remix world, or if it's an NPC that should not be affected by happiness - if (Main.remixWorld || NPCID.Sets.NoTownNPCHappiness[npc.type] || NPCID.Sets.IsTownPet[npc.type]) + if (Main.remixWorld || !npc.isLikeATownNPC || NPCID.Sets.NoTownNPCHappiness[npc.type] || NPCID.Sets.IsTownPet[npc.type]) return; var gtnpc = npc.GetGlobalNPC(); diff --git a/Items/Tools/TinkerersVoucher.cs b/Items/Tools/TinkerersVoucher.cs index 27802ea587..4bdb04a8d8 100644 --- a/Items/Tools/TinkerersVoucher.cs +++ b/Items/Tools/TinkerersVoucher.cs @@ -225,7 +225,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -298,7 +298,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -327,7 +327,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -345,8 +345,8 @@ namespace CalamityMod.Items.Tools { PrefixID.Brisk, PrefixID.Fleeting, - PrefixID.Hasty, - PrefixID.Quick + PrefixID.Hasty2, + PrefixID.Quick2 }; public override void SetDefaults() @@ -354,7 +354,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } @@ -383,7 +383,7 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 20; Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 7); // Sold by Shady Salesman Item.maxStack = Item.CommonMaxStack; } diff --git a/Items/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/Weapons/DraedonsArsenal/Vulcan.cs b/Items/Weapons/DraedonsArsenal/Vulcan.cs index 34f1498955..466b0cf0ba 100644 --- a/Items/Weapons/DraedonsArsenal/Vulcan.cs +++ b/Items/Weapons/DraedonsArsenal/Vulcan.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 34; Item.DamageType = DamageClass.Magic; Item.mana = 9; - Item.damage = 31; + Item.damage = 42; Item.knockBack = 11f; Item.useAnimation = Item.useTime = 11; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index e168061648..432a737f51 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AbyssShocker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 86; diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 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/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index a64e4316dd..8b07413bb3 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -19,6 +21,10 @@ namespace CalamityMod.Items.Weapons.Magic public static readonly SoundStyle CapSound = new("CalamityMod/Sounds/Item/HarpLV6"); public static readonly SoundStyle EndSound = new("CalamityMod/Sounds/Item/HarpEnd"); public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/HarpNoteHit"); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Wet, BuffID.Confused]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index dbfc18e573..006328f003 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -1,8 +1,10 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +16,11 @@ namespace CalamityMod.Items.Weapons.Magic public class Apotheosis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index a933cc1bdf..517ed3344d 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.DD2_SkyDragonsFuryShot; + Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -38,12 +40,13 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int parent = Projectile.NewProjectile(source, position + velocity*2, velocity, type, damage, knockback, player.whoAmI); - int child = Projectile.NewProjectile(source, position + velocity*2, velocity, type, damage, knockback, player.whoAmI, 1, 0, parent); - Main.projectile[child].penetrate = -1; - Main.projectile[child].tileCollide = false; - Main.projectile[child].scale = 0.75f; - + for (int index = 0; index < 2; ++index) + { + float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].timeLeft = 180; + } return false; } diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index 3e39e2804f..0f0175da2c 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -7,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Magic public class ArcticBearPaw : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/AuguroftheVoid.cs b/Items/Weapons/Magic/AuguroftheVoid.cs index d2ef2738fe..3f83281ca4 100644 --- a/Items/Weapons/Magic/AuguroftheVoid.cs +++ b/Items/Weapons/Magic/AuguroftheVoid.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AuguroftheVoid : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index 37e6ec4379..1852760a9c 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,7 +15,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public const int BaseDamage = 32; private int counter = 0; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 46; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 3485e92f94..a7be10ce23 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -1,6 +1,7 @@ using System; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index a451948664..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() diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 606e5db6e8..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,6 +17,12 @@ namespace CalamityMod.Items.Weapons.Magic public const int BurnOutReuseDelay = 150; public const float FizzleOutTime = 40f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + CalamityItemSets.ExtraDebuffTooltip_Player[Type] = [ModContent.BuffType()]; + } + public override void SetDefaults() { Item.width = 28; 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/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index 646bddac01..e6eb0ed443 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Magic public class Cryophobia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), BuffID.Frozen]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 15de8c3c0b..1efbc674b0 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class EidolicWail : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index a84120af62..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 = 77; + Item.damage = 120; Item.knockBack = 3.5f; Item.noMelee = true; Item.DamageType = DamageClass.Magic; - Item.mana = 32; + 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 a2182c7753..58678eb19e 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -20,8 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 130; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.useTime = 5; - Item.useAnimation = 10; + 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 b89d9b77dd..4250819277 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -65,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 8f3e2f1489..c5e2e84bc7 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Magic public class FlareBolt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 7bdd5e22e0..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 65e04f2664..f7384db5a9 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3, BuffID.Frostburn2]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index ee5d0a68df..4ae9ce6bff 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class FrostBolt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Magic/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 36061c500c..aa0592be55 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Systems.Collections; @@ -28,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic { base.SetStaticDefaults(); CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 964464d8d0..be7ec75b60 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index daf9021e23..3e2f40c47c 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/HyperdeathRiftScepter.cs b/Items/Weapons/Magic/HyperdeathRiftScepter.cs index 2a2bd2e163..95ae5b436e 100644 --- a/Items/Weapons/Magic/HyperdeathRiftScepter.cs +++ b/Items/Weapons/Magic/HyperdeathRiftScepter.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -19,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 258c342866..f92716a13e 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Ammo; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -16,6 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; public static readonly SoundStyle CastSound = new("CalamityMod/Sounds/Item/IceBarrageCast"); + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frozen, BuffID.Frostburn2]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index 36fdb84c17..37165a47a6 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 773ea06d41..916328cff6 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index 542b049cc2..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,6 +19,10 @@ 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; diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 9adc8327e4..f16e5a7b4c 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Nucleosynthesis.cs b/Items/Weapons/Magic/Nucleosynthesis.cs index 9e1bfad48f..9ee5961e6a 100644 --- a/Items/Weapons/Magic/Nucleosynthesis.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 6745b62828..9c249c2565 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; private const float Spread = 0.025f; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Magic/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/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index b2cb6a3820..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() diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 7ed607b5d1..3cfbf1f5f5 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public int DartTimer = 0; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/ShadecrystalBarrage.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs index 007414071b..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() { diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 883a3f8033..b831ec3578 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } - public override void SetDefaults() { Item.width = Item.height = 42; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 71f95c4283..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 05e3a9466b..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; diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index ac30f155d5..db54152152 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -1,5 +1,7 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; +using CalamityMod.Buffs.StatDebuffs; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class SlitheringEels : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 62f3485b23..4bef92114c 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Weapons.Magic public class SnowstormStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index 93525a8476..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() diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index d01f95d050..c2d623e371 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -41,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Sylvestaff.cs b/Items/Weapons/Magic/Sylvestaff.cs index ec5fdb3816..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 7ba64395a2..cc53fb5d63 100644 --- a/Items/Weapons/Magic/TheCauldron.cs +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -20,6 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Glow = ModContent.Request(Texture + "Glow"); } + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire]; } public override void SetDefaults() { diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index ce8e78ee62..497941912c 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index b3329489f6..9ffee14e9a 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index 66469c5d15..2d7c137bd9 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,6 +20,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/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index 1b3f482bb5..c99d7ec652 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -30,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(7). AddTile(TileID.Bookcases). 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/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/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index c245d9cecb..c98dcc9c6a 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -1,7 +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; @@ -16,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; - CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index 6b9d38be46..1bf3fc164f 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 62; - Item.damage = 50; + Item.damage = 55; Item.mana = 8; Item.DamageType = DamageClass.Magic; Item.useAnimation = Item.useTime = 15; diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 82854d3c88..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 00845c8521..16df593876 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class VitriolicViper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index f1d67cd0e7..142a0f0e20 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index e929c61010..f0f0df31f9 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 055cd4f965..ad873bcfdf 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs index e212d83ebb..8ecc1dad85 100644 --- a/Items/Weapons/Magic/Volterion.cs +++ b/Items/Weapons/Magic/Volterion.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class Volterion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Electrified]; + } public override void SetDefaults() { Item.width = 220; diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index 83ca88ed9d..de14e5a660 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -1,7 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,35 +12,32 @@ namespace CalamityMod.Items.Weapons.Magic public class Waywasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public int shotCount = 0; + public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 38; + Item.damage = 16; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 14; - Item.useAnimation = 28; - Item.reuseDelay = 23; + Item.mana = 4; + Item.useTime = 15; + Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 12f; + Item.knockBack = 2.5f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; + Item.UseSound = SoundID.Item8; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; + Item.shootSpeed = 12f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity.RotatedBy(-0.3f * (shotCount % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, shotCount % 2 == 0 ? -1 : 1); - - SoundStyle WayWashed = new("CalamityMod/Sounds/Item/WaterSplash" + (shotCount % 2 == 0 ? "1" : "2")); - SoundEngine.PlaySound(WayWashed with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 2 }, position); - - shotCount++; + float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 6e35c1d79c..4afd9910d6 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,7 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class WintersFury : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { Item.width = 36; diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index a60e099d50..776722be29 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -1,5 +1,7 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index b49a1b5680..848642e13a 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class YharimsCrystal : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 16; diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index 4fac11427b..03b3479447 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -1,5 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,7 +11,11 @@ namespace CalamityMod.Items.Weapons.Melee { public class AbsoluteZero : ModItem, ILocalizedModType { - public new string LocalizationCategory => "Items.Weapons.Melee"; + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Frostburn2]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 3261dd0d92..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 37450611ee..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,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Basher : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index 978212c6eb..9ab9a0150b 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,6 +12,10 @@ 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() { 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/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/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/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/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/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/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/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/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 e1007508fa..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() 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 581bcc23f6..cf15358643 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,7 +1,10 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -28,6 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; base.SetStaticDefaults(); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/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 5afd75b448..64a581c198 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class OldLordClaymore : CustomUseProjItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.OnFire3]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index 19639914f2..e293462460 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -1,5 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 99fbf3df9e..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; @@ -32,6 +34,10 @@ namespace CalamityMod.Items.Weapons.Melee public bool spawnTrueMeleeProj = true; public bool playSound = true; public float scaling = 1; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = Item.height = 112; 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/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 bf7fad3b44..be557346bb 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -1,8 +1,10 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 369c603161..e69e587111 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,7 +17,11 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetStaticDefaults() + { + Item.staff[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Melee/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/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 0dd8609220..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; 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..87751604c1 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,6 +12,10 @@ 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; 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/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index d2c61af5a5..11eb6c8190 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Melee public class SubmarineShocker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs index 91e8f8d9e9..300a79e127 100644 --- a/Items/Weapons/Melee/SulphurousGrabber.cs +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Systems.Collections; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -15,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 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/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/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/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/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 0bf1b87ca8..604ab4aedb 100644 --- a/Items/Weapons/Ranged/Buzzkill.cs +++ b/Items/Weapons/Ranged/Buzzkill.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/ChromaticEruption.cs b/Items/Weapons/Ranged/ChromaticEruption.cs index 8b5d134047..338835cb44 100644 --- a/Items/Weapons/Ranged/ChromaticEruption.cs +++ b/Items/Weapons/Ranged/ChromaticEruption.cs @@ -1,5 +1,7 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,7 +20,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AmmoSavedPercent = 50; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent); - public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 83d1c7daac..26e1441a09 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -1,5 +1,8 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Sounds; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class ClamorRifle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Ranged/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/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/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 index 8711433e00..24ad3ca221 100644 --- a/Items/Weapons/Ranged/OmniGun.cs +++ b/Items/Weapons/Ranged/OmniGun.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.value = Item.buyPrice(platinum: 1); // Sold by Shady Salesman Item.rare = ItemRarityID.Yellow; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; 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/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/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index 9525263705..757de74974 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.useTime = 8; Item.useAnimation = 24; - Item.reuseDelay = 15; + Item.reuseDelay = Item.useTime; Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 0b06d218fa..dff15fdead 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -1,11 +1,13 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using Terraria.DataStructures; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using System; namespace CalamityMod.Items.Weapons.Ranged { @@ -15,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { - ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index e3e4ed312b..dcd630660f 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -1,10 +1,12 @@ -using CalamityMod.CalPlayer.Dashes; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -50,6 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType(), ModContent.BuffType()]; } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 95bb662349..1d4b1b3fc4 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/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/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/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 9ed040335a..772267450b 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 = 100; + Item.damage = 85; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; 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/ElephantKiller.cs b/Items/Weapons/Rogue/ElephantKiller.cs index 615a7b1f52..efb7d64b46 100644 --- a/Items/Weapons/Rogue/ElephantKiller.cs +++ b/Items/Weapons/Rogue/ElephantKiller.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 46; Item.height = 58; - Item.damage = 110; + Item.damage = 120; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 38; 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/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 7b108c5096..cee79c4396 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,6 +1,8 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -14,8 +16,11 @@ namespace CalamityMod.Items.Weapons.Rogue public class MoltenAmputator : RogueWeapon { public float speed = 16; - public static int FlurryCount => 30; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 92; diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 445b1f993e..9b5b83721f 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -33,13 +33,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) + Projectile root = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable()) { - Main.projectile[stealth].Calamity().stealthStrike = true; - for (int i = 0; i < 8; i++) + root.Calamity().stealthStrike = true; + for (int i = 0; i < 12; i++) { - int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 1.2f); + Projectile.NewProjectile(source, player.Center, spreadVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f, 1f); } foreach (Player other in Main.ActivePlayers) { diff --git a/Items/Weapons/Rogue/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 ae93270b57..e95808976b 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public static int SpearBaseDamage => 125; public static int StarBaseDamage => 80; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 68; diff --git a/Items/Weapons/Rogue/ReboundingRainbow.cs b/Items/Weapons/Rogue/ReboundingRainbow.cs index eef227ac32..080025e3b5 100644 --- a/Items/Weapons/Rogue/ReboundingRainbow.cs +++ b/Items/Weapons/Rogue/ReboundingRainbow.cs @@ -1,7 +1,9 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using CalamityMod.Systems.Collections; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class ReboundingRainbow : RogueWeapon { public static int stealthTimeMult = 2; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 9ca38e95d4..5267d124a0 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class RotBall : RogueWeapon { + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 30; diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 9cd76f632b..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/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 74846f81a0..ea40818dcf 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -12,11 +12,17 @@ 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.5f; + public static float FallofPerTargetHitByBomb => 0.2f; + public override void SetDefaults() { Item.width = 32; Item.height = 32; - Item.damage = 425; + Item.damage = 260; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; Item.noMelee = true; 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/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 bad85a5962..1b888efe2d 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; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue public static int NormalShardCount => 3; public static int ImpaledShardCount => 5; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; + } public override void SetDefaults() { Item.width = 54; diff --git a/Items/Weapons/Rogue/SporeKnife.cs b/Items/Weapons/Rogue/SporeKnife.cs index 9a5b9bf81e..724d3697ac 100644 --- a/Items/Weapons/Rogue/SporeKnife.cs +++ b/Items/Weapons/Rogue/SporeKnife.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public static readonly SoundStyle ImpactSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeImpact") with { PitchVariance = 0.25f, MaxInstances = 10 }; public static readonly SoundStyle StealthImpactSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeStealthImpact"); public static readonly SoundStyle ChompSound = new SoundStyle("CalamityMod/Sounds/Item/SporeKnifeChomp", 1, 3) with { PitchVariance = 0.25f, MaxInstances = 10 }; + public override void SetStaticDefaults() + { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [BuffID.Poisoned]; + } public override void SetDefaults() { Item.width = 12; diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index e80d3a6b99..1737f00384 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 94; - Item.damage = 438; + Item.damage = 400; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 90; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.3f; + public override float StealthDamageMultiplier => 0.25f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index 1d4d1e40e5..1bcd4aa5c5 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -1,6 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { + CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; } diff --git a/Items/Weapons/Rogue/SubductionSlicer.cs b/Items/Weapons/Rogue/SubductionSlicer.cs index 12656fa1e0..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/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..b39d3cc3d3 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,6 +13,10 @@ 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; 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/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..2fa62ea6f8 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() 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/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..6349c7df8d 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,6 +15,10 @@ 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; 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..2e1c97e249 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,7 +17,11 @@ 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() { 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..cd30cf1de9 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() diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 90479063db..70c5412cfc 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() { 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/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/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/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..433e5068c8 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() 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/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index d4dc4bfd67..21ff204899 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -76,9 +76,11 @@ GemCrawler: Relatives to the Ilmeran Sea's prismbacks. The aquatic lizards ended BlightSlime: Slimes that have absorbed some of the blighted godly essence. Riddled with impurity, they are now more putrid flesh than gelatin and, having taken in such an amount that they seem ready to burst. Yet unlike most slimes which have relatively basic minds, these seem to be collecting mass with a purpose. Cryon: Archmage Permafrost went through great pains to not take part in combat himself, instead molding cryons to act as his personal guardians. Noticing the spread of godly essence just as many other creatures have, they have come out of stasis to combat any signs of it so that they may defend their master. CryoSlime: Slimes enchanted by the Archmage, as a host to crystallize the frozen power of the tundra into a magical metal. He cast a spell to hide away most of his creations and research soon after leaving the Godseeker's side, well aware that Yharim may attempt to exploit his previous work. +DivineSwine: A pig ascended by divine blessing. It flies beautifully through the skies, having become a shining beacon to the sun's primordial light. Incredibly rare, legends say that they reward those who give them a bountiful offering of money. Eidolist: Once members of the dragon cult, they now beg the favor of a new master. They are able to live in the abyss indefinitely thanks to their wyrm-like form, allowing them to serve a new purpose. FearlessGoldfishWarrior: Though Goldfish thrive in their ponds and lakes, many take to land during storms to feed on the worms that have also surfaced. There are even accounts of aquatic warriors who carry daggers of shimmering gold, though most consider these tales far too fishy to be credible. Frogfish: Well-camouflaged and prepared to strike at any moment, Frogfish show that the ocean is rarely as serene as it seems. There are few places where one can find true peace here in the heart of what once was an empire unrivaled. +HorribleHog: A hog corrupted by divine blight. It waddles maliciously beneath the scarlet light of the Blood Moon, leading the horde with its hideous bellow. Thankfully, it is not lost, and can be returned to its swine pristinity with the right tools. EarthElemental: After the Brimstone Elemental became dormant, the forgemasters of Azafure used clockwork and crystal to bind the powers of an elemental to a mechanical body. While formidable, it seems the dream of creating a true replacement for an elemental died unfulfilled with Azafure itself. IceClasper: Though their exact origins are an enigma, what is known is that these ethereal beings seek to stamp out any and all sources of warmth that exist in their home. Due to this fact, and taking into account the fossil record, many speculate that ice claspers may have played a vital role in the tundra's creation. ImpiousImmolator: An idol carved in the image of Her, it is lit ablaze with the crafter's lifeforce. After all, what weight does one's life hold when one wishes to see the world wreathed in Her holy flames? @@ -86,7 +88,7 @@ MantisShrimp: Though a variety of answers are given when one asks adventurers ab OverloadedSoldier: A body given life again, overflowing with the souls of warriors that perished during the Crusade who were unable to find peace. Their ravenous hunger for battle has been reignited due to sensing godly essences in the land once more. PerennialSlime: These slimes have seized a small amount of the Goddess of Life's essence. Despite her reimprisonment in the deepest depths of the Abyss, the tendrils of her influence now stretch far into the world beyond. PhantomSpirit: The spirits within the Dungeon only vaguely recall their lives, and yet there is one thing each and all clearly remember, that drives them to chaos: the man responsible for locking them in these cursed walls, and his overwhelming power– power that they have been reminded of, due to one ever growing in strength roaming their halls. -Piggy: These little swines waddle their little legs across these lands with little purpose, but they are happy with just that. Yet, little is known about how their little stomach carries a not-so-little amount of fat and muscle. +Piggy: Little swines that waddle their little legs across these lands with little purpose. They are strangely reactive to their surroundings, particularly to divine influence. Little is known about why, but that has never stopped all kinds of people from keeping them as cute little pets. ProfanedEnergyBody: Those most devout to Her travel the world, being planted into societies and acting as spies and assassins. Among their duties is constructing shrines in Her honor infused with Her divine power, that She might bless pagans blinded by darkness with visions of Her new age of light. Rimehound: These hounds were bred and trained to survive in the tundra's hostile conditions by Yharim's forces, so that they may act as scouts. Most were simply abandoned by their masters out of either necessity or choice, and were resigned to roam forever without purpose. Rotdog: Fast and furious, these hounds prowl the night, hunting prey with their razor sharp teeth. They are similar in nature to the demon eyes, both being spawned from the same vile mire, yet these creatures are tailored made to end those who have proven themselves a threat to it. @@ -116,38 +118,18 @@ Sulflounder: A relative to certain hadopelagic creatures living in the depths, t Toxicatfish: Though these fish once threatened none other than their prey, the radiation from nuclear waste generated from Draedon's old experiments has rotted both their bodies and minds. Attacking anything that comes near, this once flourishing species is now on the verge of extinction. Trasher: Despite being equipped with a mouth large enough to swallow a child whole, these crocodiles simply act as scavengers, devouring scraps and bones left over from predators' meals. Needing to conserve energy due to eating relatively little, they rarely move at their full speed unless they feel threatened. //Sunken Sea Enemies -BabyGhostBell: Despite their decidedly lower size and development, infant Ghost Bells can deliver just as many volts to unsuspecting creatures. The Ilmerian army bred thousands of Ghost Bells to maintain the lethal electric field around the sea kingdom, but all their efforts were consumed by ash in a single burning moment. -CarrionSwallower: Of all the species of fish rendered extinct by the Great Incineration, few were lucky enough to even have their corpses remain in one piece. Those that did had their souls infused with trace amounts of brimstone, which they use to hunt any that dare trespass on the old sea. -Clam: Despite having the same filter feeder appetite of the common clam, the Ilmeran species adopted defensive mechanisms against macrofauna due to their forced relocation by the Incineration. Almost all of the remaining Clams have congregated in a small den at the bottom of the sea; what makes this place unique is unknown, as few divers can withstand the ferocity of the clams in their natural abode. -Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, Cnidrions fought valiantly alongside their masters during the Incineration. Though many perished unceremoniously with the warriors that commanded them, one managed to escape a fiery demise, continuing to defend what was once the heart of the sea kingdom with a fierce loyalty. -EutrophicRay: Living life as a filter feeder, the tranquil Eutrophic Ray is quick to flee from any dangers. They are aided by their commensalistic relationship with Ghost Bells, storing the latent voltage in a sac on their underbelly for electrical muscle stimulation, allowing for great bursts of speed. -GhostBell: Commonly encountered as large walls of electric power, these high-voltage jellyfish can incapacitate most with a single touch. Even when not delivering shocks to prey, they passively release a current into the surrounding water, which the old sea kingdom exploited to drive back Yharim's crusade for decades. -GiantClam: Pearls are formed from ambient mana combining with natural limestone deposits, and are claimed to be capable of storing thoughts and memories. Although most clams die and break down before their shells can act as sufficient conduits, the largest and strongest clams can gather enough mana in their pearls for direct use in feeding and defense. -GildedAxolotl: In Ilmeris, these gracious critters were worshipped as mythical paragons of healing and good fortune. Previously considered one of many species lost to the fiery onslaught, their resurgence in the Sunken Sea is a shining ray of hope for Ilmerian survivors. -HauntedChum: During the Witch's razing of Ilmeris' seas, many of the largest fish that had never known fear in their lives were foolish enough to fight back. Even in death they remain consumed by rage, attacking those who draw near, despite being as ruined as the sea itself. -Jellyghoul: The spirits of some Ilmerians were so consumed by grief and despair that, over time, their identity and memories faded away. These souls are now confined in the blank form of phantom jellyfishes, doomed to forever haunt the Timeless Shores. -KelpieSeadragon: Kelpie Seadragons enjoy hiding in the scarlet kelp fronds of the Polyp Forest, where they can observe their surroundings without being noticed. Don’t underestimate them, as their silly-looking faces can shoot highly poisonous pellets! -LazarusLampfish: No less than living fossils, Lazarus Lampfish were long thought to be extinct. Their species survived for millions of years in the secluded depths of the Ilmeran Sea, using bright flashes of light emitted from their “lamp” to great defensive effect. -Leerslug: Named for their unsightly snapping teeth, the Leerslug uses the rather cruel reproduction method of laying their eggs within the skin of Searslugs. Once their lethargic and shaky host is no longer needed, they violently erupt out and bite another Searslug, continuing the cycle. -LostShoal: Shoals of spectral fish swim through the damp air of the Sunken shoreline, fully ignorant of their ominous demeanor and the horrible fate that befell them. -Pearlpod: Residing in the utmost depths of the Sunken Sea, these docile crustaceans consume Lantern Kelp and organic remains to survive. When curled up, their nacreous hide makes them almost identical to pearls and impervious to attacks. -PodobooKoi: The basaltic canyons are constantly being scouted by these giant Koi, whose lateral plates mineralize into an impenetrable set of armor. Carnivorous and volatile, not even the tough magmatic rock will save prey from their insatiable hunger. -PolypPanasea: The vibrant Panaseas developed a natural coating which counters the toxins of polyps, and now frequently take shelter in their tentacles. Anything that chases the fish into their home swiftly learns about the other side of this partnership. -Polyperil: Comprising a large portion of the polyp that lends the Polyp Forest its name, these sea anemone capture small prey through the venomous toxins that coat their tentacles. They have developed a mutualistic relationship with the Panaseas that populate the Forest, providing protection in exchange for live meals that give chase to the Panasea, along with nutrients from its waste. -PrismBack: Far too slow and bulky to hunt normally, these turtles subsist on a diet of purely kelp. As a result of their slow and infrequent movement, large prisms are able to accumulate on their backs, providing natural protection against threats that would not risk swallowing a razor-sharp crystal. -PrismaticGuppy: Is it a crystal? Is it a candy? No, it's a little Guppy! Thanks to the unique prismatic sheen of their scales and their striking geometric shapes, these fish can camouflage as Sea Prisms to escape pursuing predators. -Probesnout: One of just a few known seahorse species who miraculously survived the Incineration. Its efficient snout allows it to streamline nutrients from the abundant sponge in the reefs that it lives in. -SandProwler: These colorful sea serpents prowl through the sand, looking for the gleam of an unsuspecting Guppy to snack on. Due to this creature’s habit of mistakenly capturing dropped coins, Ilmerians fond of avarice began to share the namesake. -Scavenger: This odd species of crab migrated to Ilmeris after its fateful incineration. Gifted with a remarkable sense of ownership and value, they hoard any scavenged treasures as a display of social status. Trade is not a foreign concept to their tribe, and they value Pearls above all else. -SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices to find kelp due to their thin bodies. These particular flatworms are incredibly skittish, and thus fled with plenty of time to be spared from the infernal carnage. -SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things one could witness during the days when Ilmeris was unsundered. Though the kingdom's grandeur has been lost like ashes in the wind, the tranquil fish continue to swim at peace, a breathtaking reminder that not all was lost. -Searslug: A distant cousin of the Slugbuns which can withstand the extreme heat of molten basalt. Their skin is scalding to the touch, a side effect of their adaptations to the many lava dips needed to squirm around the regions it lives in. -Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Sea. It retaliates against threats through the unusual method of exploding a sac on its body that stores highly reactive chemicals, fleeing in the confusion caused by its shockwave. -Shoreskipper: This fish stands out among the coastal fauna, showing its peers a hostility unseen in its interactions with other creatures. Their outlandish behavior has fueled centuries of analogies for the folly of bipolar moral judgement. -Slugbun: The name of these cute sea dwellers is actually a misnomer given to them by outside visitors of the sea kingdom, who often sold them as exotic pets. In fact, their "bunny ear" appendages are actually their antennae taking on the appearance of the various sea prisms scattered throughout their home. -Steampod: These distant relatives of the Pearlpods possess a powerful environmental adaptation. Their ability to eject steam propels themselves through the air as a deadly pneumatic boulder that packs quite a punch. -Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. -StormlionSentry: Some Ilmeran survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. +BabyGhostBell: Ghost Bells were bred in large numbers during the Ilmeran war, due to the Ilmerian army needing a staggering amount of electricity to keep Yharim and his forces at bay. Alas, their efforts were for naught, and the kingdom collapsed after the Great Incineration. +BlindedAngler: Lacking most normal senses, these predators use a form of biological sonar to 'see' their surroundings. The glowing crystals on their backs draw in prey that use the sea's shimmering prisms as their guiding light, like a moth to the flame. +Clam: Clams once lived in the upper portion of the Ilmeran Sea before the Incineration, being forced to relocate after the battle. Though it was thanks in part to their adaptability and hardiness that their species survived, luck was also certainly on their side. +Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, cnidrions survived the Incineration due to their sheer might. They continue to defend what was once the heart of the sea kingdom from intruders, maintaining a fierce loyalty to their masters even after they have passed on. +EutrophicRay: Eutrophic Rays have formed a commensalistic relationship with Ghost Bells. The rays can store energy given by the Ghost Bells for electrical muscle stimulation, allowing for great bursts of speed. +GhostBell: These high-voltage jellyfish can incapacitate most with a single touch, and were a major factor in the Ilmerian army's strength. The sea kingdom used the electricity produced by Ghost Bells to drive back Yharim's forces, electrifying the waters so that none could cross their borders. +GiantClam: Clams slowly crystalise ambient magic around themselves into pearls, and as they grow larger, so too do their pearls. Upon growing to their full size, they are classified as Giant Clams, and gain the ability to use the magic stored in their pearls to some degree. +PrismBack: Due to the beautiful prisms and calm behavior, these animals have been taken in as pets by many over the course of centuries, even outside of Ilmeris. Though far too slow and bulky to hunt normally, the sea prisms on their back act as a lure for small fish. +SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices due to their thin bodies. These particular flatworms only ever inhabited the lower sea, and were left entirely unthreatened by the carnage that annihilated most species' homes. +SeaMinnow: Schools of sea minnows were one of the most beautiful things one could witness during the days when Ilmeris was unshattered. Those permitted into the kingdom would gather to see these fish swimming in the open sea… yet, this is but a distant past now, even for the minnows themselves. +SeaSerpent: Despite being one of the few carnivorous creatures to have ever existed in the Ilmeran Sea, even these serpents are unusually passive towards those they do not consider prey by the standards of elsewhere. The sea has only ever known one truly aggressive predator, and it abandoned a life of calming solitude years ago. +Stormlion: Some survivors of Ilmeris' downfall claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity from the battle remains buried in the sands, with several antlions having learned to both channel and harness the former kingdom's power. //Town NPCs AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to spread the Steampunker's solutions rather than clean dust and debris off of floors. They can be used to purify the world– or ruin it further, if one so desires. Archmage: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. @@ -155,6 +137,7 @@ Bandit: The bandit may have a bad habit of looting battlefields and taking what BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. TownPiggy: Waddles its little legs around with little purpose. Rumored to be a clever and obsessive hoarder. +ShadySalesman: A shady wandering merchant with even shadier products. The median buyer would question their quality, but their morbidly enticing allure is unquestionable. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. SoulSeeker: The Clone's attempt at wielding the souls of the damned as weapons, these retain slightly more autonomy than their Azafurian brethren. And yet given the striking resemblance they bear to the Clone's shell, it's arguable that they might be further from Calamitas' current soul seekers than those found in Azafure's ruins. diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 59c27c6ad8..df2bdb73d8 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -81,7 +81,7 @@ OldFashionedBuff: { RedWineBuff: { DisplayName: Red Wine Description: Increased vertical speed, reduced flight time - ItemTooltip: Causes Baguette to heal 200 HP, but reduce regeneration by 2 HP/s for 15 seconds + ItemTooltipPlayer: Causes Baguette to heal 200 HP, but reduce regeneration by 2 HP/s for 15 seconds } RumBuff: { @@ -507,6 +507,11 @@ BearBuff: { Description: A guardian angel is following you } +BeldumBuff: { + DisplayName: Iron Ball + Description: Extra shiny! +} + BloodBound: { DisplayName: Blood Bound Description: You must be desperate for company @@ -821,7 +826,7 @@ AeolianEarthBuff: { You are strengthened by primordial powers Damage reduction increased by {0}%, damage increased by {1}%, and massively buffed mana regen ''' - ItemTooltipPlayer: Increases damage, damage reduction, and mana regeneration + ItemTooltipPlayer: Increases your damage reduction by 8%, damage by 15%, and massively buffs mana regen } Afflicted: { @@ -913,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 @@ -1027,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: { @@ -1037,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: { @@ -1184,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: { @@ -1225,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: { @@ -1235,7 +1235,7 @@ WitherDebuff: { Withered... Defense decreased by {0} ''' - ItemTooltipEnemy: Decreases defense + ItemTooltipEnemy: Decreases defense by 20 } // Summons @@ -1630,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? diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index 9868158c52..96b23c9436 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -24,6 +24,11 @@ AbyssBreathLevel2: Moderately reduces breath loss in the abyss AbyssBreathLevel3: Greatly reduces breath loss in the abyss AlcoholWarning: Drinking more than 3 different alcohols might not end well with your liver ArmorPenetration: Ignores {0} points of enemy Defense +SalesmanShrinePitch: + ''' + 'You know that neat treasure you found when I was definitely not following you?' + 'Turns out there was a whole pile of those trinkets, stashed conveniently close to the treasure chest! Finders keepers - or perhaps you wanna seal a deal?' + ''' AverageDamageInfo: This weapon scales with the average of all your damage stats CanMineUelibloom: Can mine Uelibloom Ore NotConsumable: Not consumable diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index b757a152d4..d6bef60d40 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 @@ -62,3 +63,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.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 43c25400cc..cd60e9ebfd 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 ''' } @@ -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...' ''' } @@ -705,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' ''' } @@ -764,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: ''' @@ -800,6 +806,11 @@ FishStocks: { +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: { @@ -820,11 +831,12 @@ FleshTotem: { Tooltip: ''' 5% increased magic critical strike chance - +20 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 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 ''' } @@ -833,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] ''' } @@ -842,10 +854,9 @@ FrostFlare: { Tooltip: ''' All attacks and projectiles inflict [cbuff:Frostburn2] - Grants immunity to Frostburn, Chilled and Frozen Being above {0}% life grants {1}% increased damage Being below {0}% life grants {2} defense and {3}% increased max movement speed and acceleration - Grants resistance against cold attacks + Grants resistance against cold attacks, [cbuffplr:Frostburn], [cbuffplr:Chilled] and [cbuffplr:Frozen] ''' } @@ -866,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: { @@ -873,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} ''' } @@ -905,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: { @@ -959,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: { @@ -997,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: { @@ -1073,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 ''' } @@ -1096,7 +1108,7 @@ LeviathanAmbergris: { Tooltip: ''' 100% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration - Your dashes are empowered by water, knocking back and damaging enemies with vicious currents that inflict [cbuff:CalamityMod/RiptideDebuff] + Your dashes are empowered by water, knocking back and damaging enemies with vicious currents Visual effects are reduced if visibility is disabled ''' } @@ -1124,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 40 + 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 ''' } @@ -1162,13 +1175,14 @@ MoonstoneCrown: { DisplayName: Moonstone Crown Tooltip: ''' - +40 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: ''' @@ -1296,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 ''' } @@ -1343,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 ''' } @@ -1481,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' ''' } @@ -1646,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 ''' } @@ -1725,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 ''' } @@ -1870,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: { @@ -1910,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 @@ -2046,6 +2061,7 @@ TrinketofChi: { This buff expires on hit +{2} HP/s life regen for you and your teammates ''' + SalesPitch: "{$Common.SalesmanShrinePitch}" } UnholyTonic: { @@ -2064,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: { @@ -2293,6 +2310,7 @@ FrozenCube: { [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 98400df192..54d12b191e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -168,6 +168,11 @@ PrismCrate: { Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } +PrismaticGuppy: { + DisplayName: Prismatic Guppy + Tooltip: Throwing these in an aquarium would be insanity +} + RustedJingleBell: { DisplayName: Rusted Jingle Bell Tooltip: @@ -190,31 +195,10 @@ Serpentuna: { SparklingEmpress: { DisplayName: Sparkling Empress - Tooltip: "[GFB]" - TooltipNormal: + Tooltip: ''' - Fires a stream of erratic magic - After firing for long enough, the fish will shine - Ceasing use of the fish while it shines will restore some of your mana - 'An beautiful fish that seems to feed on mana' - ''' - TooltipGFB: - ''' - Fires a stream of erratic magic - After firing for long enough, the fish will shine - Ceasing use of the fish while it shines will restore some of your mana - 'Hello there, you seem to be an unfamiliar face around here. - Perhaps you are surprised a fish like me is able to speak? - No need for worry, I have no intention of any foul play. - I only hope to find a delectable meal of pure mana on this fine day! - You have a supply of mana, yes? - Would you perchance be so kind as to share a bit with this small fish? - If it is not to your liking do not worry, for I have a compromise to make you. - It should be simple enough, you provide me, the fish, with your mana. - But, in turn I shall provide you plentiful offensive power through my art of fish magic. - Is this an applicable compromise? - Good! - Then let us set out and see the world beyond as I enjoy a fine feast!' + Fires a concentrated laser to annihilate your foes + Defeated enemies explode into prism shards ''' } @@ -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: { @@ -374,10 +363,11 @@ TheDevourerofCods: { TrustyOldRod: { DisplayName: Trusty Old Rod - Tooltip: + Tooltip: Allows for especially..."exotic" hauls + SalesPitch: ''' - This ol' thing has never failed to pull in a big haul - Who knows what it will reel in next! + 'Me and Hoggart have worked together with the best fishermen in the world to bring you the most effective rod on the market!' + 'With state-of-the-art technology, you can fish anything! Don't let a single creature elude your hook anymore!' ''' } @@ -404,8 +394,13 @@ RageBait: { DisplayName: Rage Bait Tooltip: ''' - The absolute best bait on the market! And for so cheap too... - Even comes with free Sonar Potion effect! + Detects hooked fish + Profoundly unreliable + ''' + SalesPitch: + ''' + 'Do you want to know a secret? Fishing takes so long because the fish are dumb! They'll always swim right by your hook!' + 'But with this bait right here? No longer! It'll make your hook the only thing they can think of. You'll be swimming in fishes in the blink of an eye!' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index eae8af8c7e..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: "" @@ -330,8 +335,7 @@ LegendaryShortTooltip: [c/BABABA:Hold Shift to listen closer] ''' -// Add "Can be extractinated" line in 1.4.5 port DisgustingSlop: { DisplayName: Disgusting Slop - Tooltip: "" + 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 36ea72fa67..c774e5f087 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson @@ -106,6 +106,16 @@ HermitsBoxofOneHundredMedicines: { ''' } +IronBall: { + DisplayName: Iron Ball + Tooltip: + ''' + Summons a living iron ball + the pet to pet it + the pet to have it sit on your shoulder + ''' +} + JoyfulHeart: { DisplayName: Joyful Heart Tooltip: It's oddly warm. Attracts the forbidden one diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 26d86e7fa2..1d0025d12a 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: { @@ -803,7 +786,12 @@ GluttonyBlender: { Tooltip: ''' A strange industrial contraption which appears to process food - Has the potential to turn food into something more useful... maybe + 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!' ''' } @@ -847,16 +835,6 @@ ExoObelisk: { Tooltip: "'Energize the atmosphere with exo energy.'" } -ForgottenNobleStatue: { - DisplayName: Forgotten Noble Statue - Tooltip: "" -} - -ForgottenScholarStatue: { - DisplayName: Forgotten Scholar Statue - Tooltip: "" -} - FrigidMonolith: { DisplayName: Frigid Monolith Tooltip: "'Enchant the sky with frosty auroras.'" @@ -887,15 +865,6 @@ NavyPrismTorch: { Tooltip: Can be placed in water } -AmidiasPainting: { - DisplayName: Sea King's Release - Tooltip: - ''' - 'O. Rios' - 'September-October!' - ''' -} - CalamityCanvas2023: { DisplayName: Calamity Canvas 2023 Tooltip: @@ -933,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 ''' } @@ -994,11 +963,6 @@ SulphurousTorch: { Tooltip: Can be placed in water } -SunkenIdol: { - DisplayName: Sunken Idol - Tooltip: "" -} - ThaumaticChair: { DisplayName: Thaumatic Chair Tooltip: One of Chloe's finest creations @@ -1011,6 +975,11 @@ TheMonument: { A monument celebrating the accomplishments of capitalism Funded by the taxes of nearby Town NPCs, though they may not be too happy about that ''' + SalesPitch: + ''' + 'Don't you think your town is a bit too boring? Don't you wish you could get more money out of your troubles? Well, I've got you the perfect two-in-one deal!' + 'This statue I made myself is so marvelous that it'll singlehandedly raise the price of housing around here! Just sit back, and enjoy the sight and the money!' + ''' } ThermalTorch: { @@ -4722,4 +4691,21 @@ MossyStone: { GreedPot: { DisplayName: Urn of Avarice Tooltip: Offer your treasures to the Urn, and your avarice may at last be satiated + SalesPitch: + ''' + 'Say, you use all kinds of ores for your stuff, but finding precious minerals isn't easy, is it? Well, I got the solution for you!' + 'Just throw any ore you got in this urn and they'll turn into even rarer ones! No more looking for tungsten for hours on end!' + ''' +} + +HorribleHogBanner.DisplayName: Horrible Hog Banner + +EutrophicSandWall: { + DisplayName: Unsafe Eutrophic Sand Wall + Tooltip: "" +} + +EutrophicSandWallSafe: { + DisplayName: Eutrophic Sand Wall + Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 3e8ffb860e..18cd1593dd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -22,7 +22,7 @@ Baguette: { Tooltip: ''' {$CommonItemTooltip.MinorStats} - Goes well with [cbuff:CalamityMod/RedWineBuff] + Goes well with [cbuffplr:CalamityMod/RedWineBuff] [c/FCE391:'je suis Monte'] ''' } @@ -65,7 +65,8 @@ DeliciousMeat: { Tooltip: ''' {$CommonItemTooltip.MediumStats} - 'So very delicious' + {$Common.NotConsumable}, but takes {0} minutes to regenerate + 'A blessed strip of pork that never seems to be entirely consumed...' ''' } @@ -159,8 +160,17 @@ SupremeManaPotion: { TheConcoction: { DisplayName: The Concoction - EasterEggText: Removes 500 life - Tooltip: "" + EasterEggText: Removes 9999 life + Tooltip: + ''' + Restores 9999 life + Can even be used while you have potion sickness if Quick Heal is repeatedly pressed + ''' + SalesPitch: + ''' + 'Aren't you tired of how unreliable your healing potions are? What if you're in the middle of a zombie horde and sick to the core of those things?!' + 'With my concoction, you won't have to worry about that! Just a sip of this bad boy and you'll be good as new, ready to take on the world!' + ''' } ZenPotion: { @@ -187,6 +197,11 @@ BaconOil: { Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} When combined with drinking Bacon Oil straight, mobility becomes zanier ''' + SalesPitch: + ''' + 'Monks go on and on about forgoing attachment. I don't think this is what they meant. It's better!' + 'Don't mind the accident disclaimer: get yourself some of this slippery fat oil, and not a bit of this world will be able to hold you down!' + ''' } BloodyMary: { @@ -494,6 +509,11 @@ TheElixir: { Functions as a Potion of Return Occasionally sends you... [c/AA23C4:somewhere else] ''' + SalesPitch: + ''' + 'Return potions are nifty and all, but they taste like bogus! But with my special formula, it'll magically taste like your favorite food!' + 'Besides, you ain't finding them for much cheaper around these parts. Trust me, you're practically stealing me!' + ''' } Vodka: { @@ -582,7 +602,11 @@ Mangosteen: { QualitySlop: { DisplayName: Quality Slop - Tooltip: "{$CommonItemTooltip.MajorStats}" + Tooltip: + ''' + {$CommonItemTooltip.MajorStats} + 'You only like it because it's good' + ''' } Salak: { @@ -610,4 +634,9 @@ TheSandwich: { Alcohol effects will not expire while under the effects of The Sandwich 'Might actually taste good if it was the only thing you'd ever eaten...' ''' + SalesPitch: + ''' + '...You want to buy my lunch?' + 'Well, no matter! But it won't be cheap! This sandwich is made with the best the market can offer, so ready your wallet!' + ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 3ec4c48e04..3ae132b727 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -292,6 +292,11 @@ Terminus: { TheHousingContract: { DisplayName: The Housing Contract Tooltip: Use to adopt a piggy for your town + SalesPitch: + ''' + 'Have you ever wanted to take care of a piggy? As part of our campaign to stop piggy abuse, you can get one here and now!' + 'Just sign here and we'll deliver you one posthaste!' + ''' } YharonEgg: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index c730a6f062..589bc10f15 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -23,6 +23,11 @@ AggressiveVoucher: { 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: { @@ -51,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 ''' } @@ -160,6 +165,11 @@ CombatVoucher: { 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: { @@ -187,7 +197,7 @@ DisgustingMeat: { Tooltip: ''' will remove health and mana upgrades, use with no Calamity upgrades to remove vanilla upgrades - will remove rage and adrenaline upgrades, plus other miscellaneous boosters + will remove Rage and Adrenaline upgrades, plus other miscellaneous boosters such as Demon Heart Removed boosters will be vomited out of you as items ''' } @@ -236,6 +246,11 @@ HurriedVoucher: { 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: { @@ -311,6 +326,11 @@ OddVoucher: { 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: { @@ -339,7 +359,7 @@ RelicOfResilience: { Holding this item creates orbiting rock shards around you and nearby allies 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 150 and minimum damage reduction to 10% + 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 @@ -409,10 +429,14 @@ TheGift: { DisplayName: The Gift Tooltip: ''' - Drop this fine gift on one of your Town NPCs as a token of appreciation + Drop this gift on one of your Town NPCs as a token of appreciation May make them either love you or hate you, you'll never know until they open it! Effect will last for 24 hours - [c/F54278:'There's no return policy, better be responsible'] + ''' + SalesPitch: + ''' + 'Buying gifts for people is hard, and you gotta make sure your people are happy, so how about we kill two birds with one stone?' + 'Hand this nifty box to someone and it'll suddenly contain the perfect gift for the person you handed it to!' ''' } @@ -436,6 +460,11 @@ UnbreakableVoucher: { Selectable Reforges: {1} [c/aaaaaa:Shift- in your inventory to cycle between targeted reforges] ''' + SalesPitch: + ''' + 'That goblin over there, he's just scamming you for your money, you know? But don't worry, me and Hoggart have a solution for that!' + 'Just give him this and watch as he hammers your gear like he was struck with divine inspiration! It'll be like a new item!” + ''' } VoodooDemonVoodooDoll: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 4b3a6a68e5..1e018efe36 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -41,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.'] ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index ce22045fcb..dbe76d7dae 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...' ''' } @@ -1000,7 +990,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 +1022,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 +1033,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 +1059,7 @@ Volterion: { Waywasher: { DisplayName: Waywasher - Tooltip: Casts two large swirling waves + Tooltip: Casts a deluge of inaccurate water bolts } Wingman: { @@ -1111,6 +1105,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 bb2c4e9f5f..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 ''' } @@ -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 ''' } @@ -804,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 ''' @@ -904,14 +895,14 @@ Nadir: { DisplayName: Nadir Tooltip: ''' - Fires void essences which flay nearby enemies with [cbuff:CalamityMod/Voidfrost] tentacles + Fires void essences which flay nearby enemies with tentacles 'The abyss has stared back at you long enough. It now speaks, and it does not speak softly' ''' } Nebulash: { DisplayName: Nebulash - Tooltip: Fires a whip sword that emits particle explosions on hit and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Tooltip: Fires a whip sword that emits particle explosions on hit and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] } NeptunesBounty: { @@ -934,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.] @@ -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 aac6009be7..d026b18452 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 cause enemies to become [cbuff:CalamityMod/MarkedforDeath] Press to zoom out Standing still provides increasing damage bonuses up to 25% Standing still for 5 or more seconds while using the scope ability will summon an aurora @@ -140,7 +145,7 @@ AuroraBlazer: { DisplayName: Aurora Blazer Tooltip: ''' - Spews a nebula stream which forms a star shaped pattern and inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Spews a nebula stream which forms a star shaped pattern and spreads the [cbuff:CalamityMod/AstralInfectionDebuff] Uses gel for ammo ''' } @@ -182,7 +187,7 @@ BlissfulBombardier: { Tooltip: ''' Launches a crystalline missile high into the sky, raining holy fire on the cursor - The missile relentlessly seeks out a target before bursting into a massive [cbuff:CalamityMod/HolyFlames] explosion + The missile relentlessly seeks out a target before bursting into a massive explosion ''' } @@ -217,7 +222,7 @@ BlossomFlux: { BrimstoneFury: { DisplayName: Brimstone Fury - Tooltip: Converts wooden arrows into spreads of 3 brimstone bolts + Tooltip: Converts wooden arrows into a spread of 3 brimstone bolts } BulletFilledShotgun: { @@ -236,7 +241,7 @@ Buzzkill: { Tooltip: ''' Hold to rev up a buzzsaw that deals close-range damage - Release to fire the buzzsaw, which bounces off tiles and causes [cbuff:CalamityMod/HeavyBleeding] in foes + Release to fire the buzzsaw, which bounces off tiles and shreds foes Revving up the saws increases their damage and allows them to pierce more enemies 'Not to be confused with the Sawed-On Shotgun' ''' @@ -244,7 +249,7 @@ Buzzkill: { ChickenCannon: { DisplayName: Chicken Cannon - Tooltip: Fires chicken flares which create enormous incendiary explosions of [cbuff:CalamityMod/Dragonfire] + Tooltip: Fires chicken flares which create enormous [cbuff:CalamityMod/Dragonfire] explosions } ChromaticEruption: { @@ -259,14 +264,18 @@ ChromaticEruption: { ClamorRifle: { DisplayName: Clamor Rifle - Tooltip: Converts musket balls into homing energy bolts + Tooltip: + ''' + Converts musket balls into homing energy bolts + Energy bolts briefly stun enemies + ''' } CleansingBlaze: { DisplayName: Cleansing Blaze Tooltip: ''' - Unleashes a torrent of [cbuff:CalamityMod/GodSlayerInferno] flames which can pass through tiles + Unleashes a torrent of [cbuff:CalamityMod/GodSlayerInferno] which can pass through tiles Uses gel for ammo ''' } @@ -327,7 +336,7 @@ CorinthPrime: { CorrodedCaustibow: { DisplayName: Corroded Caustibow - Tooltip: Converts wooden arrows into slow, powerful shells that trail an [cbuff:CalamityMod/Irradiated] aura + Tooltip: Converts wooden arrows into slow, powerful shells that trail an irradiated aura } CrackshotColt: { @@ -383,9 +392,9 @@ DragonsBreath: { DisplayName: Dragon's Breath Tooltip: ''' - Fires [cbuff:CalamityMod/Dragonfire] fireballs at an accelerating pace + Fires intense blasts of [cbuff:CalamityMod/Dragonfire] at an accelerating pace Upon firing for long enough, you will begin using a cartridge of energy - While using a cartridge you will shoot a draconic beam of [cbuff:CalamityMod/Dragonfire] that doesn't consume ammo + While using a cartridge you will shoot a draconic beam of pure [cbuff:CalamityMod/Dragonfire] that doesn't consume ammo Once a cartridge has been ejected you will return to the original fire rate {$CommonItemTooltip.PercentChanceToSaveAmmo} ''' @@ -395,7 +404,7 @@ Drataliornus: { DisplayName: Drataliornus Tooltip: ''' - Fires an escalating stream of fireballs + Fires an escalating stream of [cbuff:CalamityMod/Dragonfire] arrows Fireballs rain meteors, leave dragon dust trails, and launch additional bolts at max speed Taking damage while firing the stream will interrupt it and reduce your wing flight time Press to fire two devastating barrages of five empowered fireballs @@ -415,7 +424,7 @@ EternalBlizzard: { Eviscerator: { DisplayName: Eviscerator - Tooltip: Converts musket balls into fast-moving blood clots that cause [cbuff:CalamityMod/BurningBlood] + Tooltip: Converts musket balls into fast-moving blood clots } FetidEmesis: { @@ -434,7 +443,7 @@ FirestormCannon: { Tooltip: ''' Fires a rapid barrage of flares that builds up a searing heat in the weapon - Firing for too long overheats the weapon, leaving it unusable for a short period + Firing for too long overheats the weapon, leaving it unusable for a short period and setting you [cbuffplr:OnFire] Press to put away the weapon, which preserves its heat {$CommonItemTooltip.PercentChanceToSaveAmmo} 'What could go wrong?' @@ -516,7 +525,7 @@ GoldenEagle: { Goobow: { DisplayName: Goobow - Tooltip: Fires two streams of slime + Tooltip: Addtionally fires two streams of damaging slime } GunkShot: { @@ -561,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] ''' } @@ -604,7 +614,7 @@ Hydra: { Fires a spread of 3 blood globs imbued with [cbuff:Venom] Grows a gun-head every 3 seconds, up to a maximum of 3 heads Press to command any existing heads to fire - Press to launch the heads for powerful explosive damage, briefly inflicting [cbuff:CalamityMod/GalvanicCorrosion] + Press to launch the heads for powerful explosive damage [c/9D80B0:Fusion of heavy machinery and Lernaean blood] ''' } @@ -642,7 +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' ''' @@ -710,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} ''' } @@ -767,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: { @@ -849,8 +861,11 @@ OmniGun: { The second shot is a burst of 10 standard bullets The third shot is a devastating point blank spread The fourth shot is a dangerous but powerful grenade which destroys everything, including you - 'What kind of gun is it?' - 'Yes' + ''' + 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!' ''' } @@ -859,7 +874,7 @@ OpalStriker: { 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] ''' } @@ -904,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 @@ -917,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 ''' } @@ -1072,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} ''' } @@ -1109,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: @@ -1149,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: { @@ -1186,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} @@ -1210,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: { @@ -1251,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' ''' @@ -1259,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: { @@ -1277,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 ''' } @@ -1293,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: @@ -1332,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' ''' } @@ -1352,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 ''' @@ -1378,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: { @@ -1390,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 ''' } @@ -1412,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 ''' } @@ -1423,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 ''' } @@ -1446,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' ''' @@ -1457,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} ''' } @@ -1485,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 6f959058de..4d9c18b3c1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -39,7 +39,7 @@ AuroradicalThrow: { Launches a star that splits after a short period of time Split stars home in on nearby enemies after a few seconds Stealth strikes summon a meteor upon enemy impact - Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] + Spreads the [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -47,7 +47,7 @@ BallisticPoisonBomb: { DisplayName: Ballistic Poison Bomb Tooltip: ''' - Throws a sticky bomb that explodes into spikes and [cbuff:Venom] clouds + Throws a sticky bomb that explodes into spikes and venomous clouds Stealth strikes erupt into more clouds with a longer lasting [cbuff:Venom] ''' } @@ -107,7 +107,7 @@ BurningStrife: { DisplayName: Burning Strife Tooltip: ''' - Throws a [cbuff:CalamityMod/Shadowflame] spiky ball that explodes into flames + Throws an enchanted spiky ball that explodes into [cbuff:CalamityMod/Shadowflame] Stealth strikes make the ball erupt into tentacles on hit 'Definitely not pocket safe' ''' @@ -129,6 +129,7 @@ Celestus: { ''' Throws a high-velocity scythe that splits into multiple phantom scythes on enemy hits Stealth strikes reverse direction and home in on enemies after returning to the player + Struck enemies are decimated by [cbuff:CalamityMod/MiracleBlight] ''' } @@ -179,7 +180,7 @@ CosmicKunai: { Tooltip: ''' Fires a rapid stream of short-range kunai - Stealth strikes make kunai pierce foes, travel farther, and spawn 5 homing scythes + Stealth strikes make kunai pierce foes, travel farther, and spawn 9 homing scythes ''' } @@ -259,7 +260,7 @@ CursedDagger: { DisplayName: Cursed Dagger Tooltip: ''' - Throws a fast cursed dagger and two inaccurate weaker daggers that inflict [cbuff:CursedInferno] + Throws a fast cursed dagger and two inaccurate weaker daggers Stealth strikes throw a single dagger that bursts into a [cbuff:CursedInferno] vortex ''' } @@ -278,7 +279,7 @@ DeepWounder: { DisplayName: Deep Wounder Tooltip: ''' - Throws an abyssal hatchet that inflicts [cbuff:CalamityMod/HeavyBleeding] and [cbuff:CalamityMod/CrushDepth] to the enemies it hits + Throws an abyssal hatchet Stealth strikes cause the hatchet to stick to struck enemies, releasing a barrage of water projectiles Water projectiles launch at the closest enemy after a brief delay ''' @@ -399,8 +400,8 @@ EpidemicShredder: { DisplayName: Epidemic Shredder Tooltip: ''' - Throws a [cbuff:CalamityMod/Plague] boomerang that releases plague seekers when it hits tiles or enemies - Stealth strikes cause the boomerang to release plague seekers constantly as it travels + Throws an infected boomerang that releases [cbuff:CalamityMod/Plague] seekers when it hits tiles or enemies + Stealth strikes cause the boomerang to release [cbuff:CalamityMod/Plague] seekers constantly as it travels Contrary to its name, it will probably cause an epidemic if used incorrectly ''' } @@ -419,7 +420,7 @@ ExecutionersBlade: { DisplayName: Executioner's Blade Tooltip: ''' - Throws a stream of homing blades that inflict [cbuff:CalamityMod/GodSlayerInferno] + Throws a stream of homing blades Stealth strikes summon a guillotine of blades on hit ''' } @@ -558,7 +559,6 @@ GraveGrimreaver: { Hurls a cursed scythe which homes in The scythe summons skulls as it flies and explodes into bats on hit Stealth strikes spawn a flood of bats and falling skulls when destroyed - Inflicts [cbuff:CursedInferno] and [cbuff:Confused] 'A dapper skeleton's weapon of choice' ''' } @@ -568,7 +568,7 @@ HardenedHoneycomb: { Tooltip: ''' Fires a honeycomb that shatters into fragments - Stealth strikes grant the honey buff on hit and spawn bees + Stealth strikes grant the [cbuffplr:Honey] buff on hit and spawn bees ''' } @@ -577,9 +577,8 @@ HeavenfallenStardisk: { Tooltip: ''' Throws a stardisk upwards which then launches itself towards your mouse cursor - Explodes into a star of astral bolts on hit + Explodes into a star of astral bolts which spread the [cbuff:CalamityMod/AstralInfectionDebuff] Stealth strikes rain astral energy bolts from the sky - Inflicts [cbuff:CalamityMod/AstralInfectionDebuff] ''' } @@ -652,7 +651,7 @@ JawsOfOblivion: { ''' Throws a tight spread of six reaper teeth with [cbuff:Venom] that stick in enemies The [cbuff:Venom] can stack when more teeth are stuck in an enemy - Stealth strikes cause the teeth to emit a crushing [cbuff:CalamityMod/HadopelagicPressure] shockwave on impact + Stealth strikes cause the teeth to emit a crushing shockwave on impact 'You're gonna need a bigger boat' ''' } @@ -688,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] ''' } @@ -719,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 ''' @@ -729,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 ''' @@ -889,7 +887,6 @@ ProfanedPartisan: { Throws a profaned spear that splits into miniature spears upon hitting an enemy Stealth strikes remain impaled in an enemy for 10 seconds While an enemy is impaled, all spears that strike them instead shatter into exploding stars - Inflicts [cbuff:CalamityMod/HolyFlames] ''' } @@ -897,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 ''' } @@ -934,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 ''' } @@ -968,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 ''' } @@ -1007,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 ''' } @@ -1033,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 ''' } @@ -1116,7 +1110,6 @@ SpearofPaleolith: { Throws an ancient spear that shatters into fossil shards upon hitting an enemy Stealth strikes remain impaled in the enemy for 10 seconds While an enemy is impaled, all spears that strike them erupt into even more fossil shards - Inflicts [cbuff:CalamityMod/ArmorCrunch] ''' } @@ -1135,7 +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 ''' } @@ -1155,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' ''' @@ -1165,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'] ''' @@ -1236,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 ''' } @@ -1248,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' ''' @@ -1258,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' ''' } @@ -1288,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' ''' @@ -1298,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 ''' } @@ -1317,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 @@ -1328,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 ''' } @@ -1338,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' ''' } @@ -1400,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 ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index a3f4cfa7b6..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 @@ -72,7 +72,7 @@ AtlasMunitionsBeacon: { BelladonnaSpiritStaff: { DisplayName: Belladonna Spirit Staff - Tooltip: Summons a cute forest spirit that flings magical [cbuff:Poisoned] petals + Tooltip: Summons a cute forest spirit that flings magical petals } BlackHawkRemote: { @@ -90,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 ''' } @@ -143,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 ''' } @@ -204,7 +210,8 @@ CosmicImmaterializer: { Tooltip: ''' Summons a cosmic energy spiral to fight for you - The orb will fire swarms of homing energy bolts that cause [cbuff:CalamityMod/MiracleBlight] + The spiral will fire swarms of homing energy bolts when enemies are detected by it + Struck enemies are cleansed by [cbuff:CalamityMod/MiracleBlight] There can only be one energy spiral ''' } @@ -388,7 +395,7 @@ FleshOfInfidelity: { FlowersOfMortality: { DisplayName: Flowers of Mortality - Tooltip: Summons five rainbow flowers over your head that inflict [cbuff:CalamityMod/ElementalMix] + Tooltip: Summons five rainbow flowers over your head } ForgottenApexWand: { @@ -478,6 +485,7 @@ HivePod: { ''' {$CommonItemTooltip.Sentry} Summons an astraglomerate to spawn glomerings at your enemies + Glomerings spread the [cbuff:CalamityMod/AstralInfectionDebuff] on impact ''' } @@ -673,17 +681,6 @@ ScabRipper: { Tooltip: Summons a baby blood crawler to protect you } -SeashineHilt: { - DisplayName: Seashine Hilt - Tooltip: - ''' - Summons a brilliant sea prism blade to slice your enemies - Blades will charge up while you hold this item - Pressing will order all fully charged blades to swipe at your cursor - Each sword only consumes half a minion slot - ''' -} - ShellfishStaff: { DisplayName: Shellfish Staff Tooltip: Summons a shellfish to latch onto enemies and inflict [cbuff:CalamityMod/ShellfishClaps] @@ -748,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: { @@ -774,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 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 6f25f07e11..e2748e631c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -13,7 +13,7 @@ ClaretCannon: { ''' Fires a hypercondensed claret round The round explodes upon striking an enemy and releases blood orbs - The explosion shreds enemies, inflicting [cbuff:CalamityMod/Laceration] and dramatically reducing their defense + The explosion shreds enemies, dramatically reducing their defense Picking up the blood orbs will reduce [cbuffplr:PotionSickness] when possible If you do not have [cbuffplr:PotionSickness], your natural regeneration will be enhanced Can only fire once every 10 seconds @@ -31,7 +31,7 @@ EyeofMagnus: { Tooltip: ''' Fires seeking cosmic masses that restore health and mana on hit - Explodes into a nebula cloud which reduces enemy protection + Explodes into a nebula cloud that cause enemies to become [cbuff:CalamityMod/MarkedforDeath] {$Common.AverageDamageInfo} ''' } @@ -40,7 +40,7 @@ LunicEye: { DisplayName: Lunic Eye Tooltip: ''' - Fires seeking energy bolts that reduce enemy protection + Fires seeking energy bolts that cause enemies to become [cbuff:CalamityMod/MarkedforDeath] {$Common.AverageDamageInfo} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 1323a80e94..036bffd957 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -1,5 +1,7 @@ BabyCannonballJellyfish.DisplayName: Baby Cannonball Jellyfish Bloatfish.DisplayName: Bloatfish +BrainIllusion.DisplayName: Brain Illusion +BloodBomb.DisplayName: Blood Bomb BobbitWormHead.DisplayName: Bobbit Worm BoxJellyfish.DisplayName: Box Jellyfish Burrower.DisplayName: Burrower @@ -11,7 +13,10 @@ TinySquid: Tiny Squid Cuttlefish.DisplayName: Cuttlefish DevilFish.DisplayName: Devil Fish DevilFishAlt.DisplayName: Devil Fish +DraconicSwarmer.DisplayName: Draconic Swarmer +Dragonfolly.DisplayName: Dragonfolly EidolonWyrmHead.DisplayName: Eidolon Wyrm +FalseBrain.DisplayName: False Brain GiantSquid.DisplayName: Giant Squid GulperEelHead.DisplayName: Gulper Eel Laserfish.DisplayName: Laserfish @@ -20,9 +25,11 @@ MirageJelly.DisplayName: Mirage Jelly MorayEel.DisplayName: Moray Eel OarfishHead.DisplayName: Oarfish ReaperShark.DisplayName: Reaper Shark +Shoreskipper.DisplayName: Shoreskipper SlabCrab.DisplayName: Slab Crab ToxicMinnow.DisplayName: Toxic Minnow Viperfish.DisplayName: Viperfish +WildBumblebirb.DisplayName: Draconic Swarmer AcidEel.DisplayName: Acid Eel BabyFlakCrab.DisplayName: Baby Flak Crab BloodwormNormal.DisplayName: Bloodworm @@ -165,6 +172,7 @@ CrawlerTopaz.DisplayName: Topaz Crawler CrimulanBlightSlime.DisplayName: Crimulan Blight Slime Cryon.DisplayName: Cryon CryoSlime.DisplayName: Cryo Slime +DivineSwine.DisplayName: Divine Swine EbonianBlightSlime.DisplayName: Ebonian Blight Slime Eidolist.DisplayName: Eidolist FearlessGoldfishWarrior.DisplayName: Fearless Goldfish Warrior @@ -179,6 +187,7 @@ OverloadedSoldier.DisplayName: Overloaded Soldier PerennialSlime.DisplayName: Perennial Slime PhantomSpirit.DisplayName: Phantom Spirit Piggy.DisplayName: Piggy +PiggyGold.DisplayName: Gold Piggy PlanterasFreeTentacle.DisplayName: Plantera's Tentacle ProfanedEnergyBody.DisplayName: Profaned Energy Rimehound.DisplayName: Rimehound @@ -187,10 +196,8 @@ ScornEater.DisplayName: Scorn Eater ShockstormShuttle.DisplayName: Shockstorm Shuttle Shroomble.DisplayName: Shroomble Stormlion.DisplayName: Stormlion -StormlionSentry.DisplayName: Stormlion Sentry Sunskater.DisplayName: Sunskater SuperDummyNPC.DisplayName: Super Dummy -WildBumblebirb.DisplayName: Draconic Swarmer WulfrumAmplifier.DisplayName: Wulfrum Amplifier WulfrumDrone.DisplayName: Wulfrum Drone WulfrumGyrator.DisplayName: Wulfrum Gyrator @@ -258,52 +265,18 @@ MicrobialCluster.DisplayName: Microbial Cluster Sulflounder.DisplayName: Sulflounder Toxicatfish.DisplayName: Toxicatfish Trasher.DisplayName: Trasher -AlphaSeaMinnow.DisplayName: Alpha Sea Minnow -AlphaSeaMinnowGold.DisplayName: Gold Alpha Sea Minnow -MinnowPrime: Minnow Prime BabyGhostBell.DisplayName: Baby Ghost Bell -CarrionSwallower.DisplayName: Carrion Swallower +BlindedAngler.DisplayName: Blinded Angler Clam.DisplayName: Clam EutrophicRay.DisplayName: Eutrophic Ray -FesteringRemains.DisplayName: Festering Remains GhostBell.DisplayName: Ghost Bell GiantClam.DisplayName: Giant Clam Clamitas: Clamitas SupremeClamitas: Supreme Clamitas -GildedAxolotl.DisplayName: Gilded Axolotl -GoldBabyGhostBell: Gold Baby Ghost Bell -GoldPolypPanasea: Gold Polyp Panasea -GoldPrismaticGuppy: Gold Prismatic Guppy -HauntedChum.DisplayName: Haunted Chum -Jellyghoul.DisplayName: Jellyghoul -KelpieSeadragon.DisplayName: Kelpie Seadragon -LazarusLampfish.DisplayName: Lazarus Lampfish -Leerslug.DisplayName: Leerslug -LostShoal.DisplayName: Lost Shoal -PearlpodBlack.DisplayName: Pearlpod -PearlpodPink.DisplayName: Pearlpod -PearlpodWhite.DisplayName: Pearlpod -PodobooKoi.DisplayName: Podoboo Koi -PolypPanasea.DisplayName: Polyp Panasea -Polyperil.DisplayName: Polyperil PrismBack.DisplayName: Prism-Back -Probesnout.DisplayName: Probesnout -ProbesnoutGold.DisplayName: Gold Probesnout -PrismaticGuppy.DisplayName: Prismatic Guppy -RadiantBabyGhostBell: Radiant Baby Ghost Bell -RadiantPolypPanasea: Radiant Polyp Panasea -RadiantPrismaticGuppy: Radiant Prismatic Guppy -RadiantSlugbun: Radiant Slugbun -SandProwler.DisplayName: Sand Prowler -SandProwlerNested.DisplayName: Sand Prowler -Scavenger.DisplayName: Scavenger SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow -SeaMinnowGold.DisplayName: Gold Sea Minnow -Searslug.DisplayName: Searslug -Sharkoon.DisplayName: Sharkoon -Slugbun.DisplayName: Slugbun -Steampod.DisplayName: Steampod +SeaSerpent1.DisplayName: Sea Serpent BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker @@ -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 @@ -573,6 +546,34 @@ SeaKing: { } } +ShadySalesman: { + DisplayName: Shady Salesman + Census.SpawnCondition: Defeat a Horrible Hog + + Chat: { + Normal1: Have you ever wondered why coins are shiny? Simple! It's to match my partner's dazzling products! + Normal2: Have you ever had a dream? If you have the cash, I can sell you several! + Normal3: Whatever you are thinking, I have the perfect thing for you, at a genuinely excessive discount! + Normal4: Is your life rapidly shrinking? Want to know this world's marvels before your time comes? Are the local merchants only showing you worthless hogwash?! Worry not, Hoggart and I have just the solution! Hogwash sold separately. + Normal5: There's a saying that goes "the grass is greener on the other side." It's absolute balderdash!! For 5 platinum coins, you can buy our Greener Paint and make your life the greenest! + Normal6: They say keeping an Angel Statue nearby is more dangerous than a loaded gun. That's why I own multiple guns - in case some hooligan tries to sell me an Angel Statue! + TownPigPresent1: You're searching for the lil' Piggy? Don't worry, chum! Hoggart and I gave it a Camo-Projector 2000 so it could disappear into the night. This way, not a single rotbrain will lay their nasty half-fingers on it, huehe! + TownPigPresent2: Rumors are runnin' around that I'm inexplicably two Pigg'ins stacked on top of each other. What shameless slander! Don't they know that, if that were true, I'd charge twice the price? Hahaha! + TownPigPresent3: You better take real good care of that piglet. Your sight gotta be good for something other than eyeballing my discounts! Otherwise, who knows what will happen to the swine stock market... + TownPigPresent4: Where the Piggy went? Could've sworn I saw it chasing down a four-legged carrot. Now's your chance to chase Fortune and Glory, pal, by buying these MARVELOUS wares! + Rain: People always say "rain, rain, go away! Come back another day!", but everyone knows it would be better if it came back never! To solve this, I intend to invest in Hoggart's Dome Program, we just need 500 platinum coins to get it off the ground! + WindyDay: Aren't you tired of your house being blown away by any shoddy gust of wind? Well, I have the solution to your problem! With my state-of-the-art industrial super glue (for only 5 gold coins a pack), you too may survive the attack of invaders with outstanding lung capacity! + Desert: Exhausted from this oven-like heat? Yearning for something to help you cool down? Check out our revolutionary new product: water! It comes in all flavors of flavorless! Any bottle shape is available, from round to triangular! Feel the chill of molten ice as it enters your guts! It even has healing properties! Sip our free sample for the low price of 50 gold! + Tundra: Did you ever hear the tragedy of Kevin Bacon the Wise? I thought not, It's not a story the Elumphants would tell you. Kevin Bacon was a Ham Lord of the Hogs, so powerful and so wise he could use his Hogtusk to influence metal to create gold... Unfortunately, he taught his apprentice everything he knew, then his apprentice out-cashed and deposed him. Ironic. He could save others from debt, but not himself. + Graveyard: Does that zombie look like a happy customer? No!! It's full of maggots!! It has no life savings!! While you still do, hurry up and spend yours on a funky edition, happiness-smelling Maggot Repellent! + BloodMoon1: These shambling deadheads are the worst! How am I supposed to rip people off when they're all either dead, broke or fighting for their lives?! + BloodMoon2: Like my partner always says, price makes the prize! Hire our Moon Doom Cannon, and enjoy a whole year without the meatsack invasion! Fund the construction of the Eclipse variant and get a deluxe model with a neat robotic decal! All for 5000 platinum coins! + BloodMoon3: Violence is at every corner tonight, huh? Remember these words, buddy: make deals, not war! + Hardmode: Those pesky merchants still want to sell you full-price, low quality copper tools?! Bird droppings!! Barter with me, and you'll receive Palladium at HOG-WILD prizes! + MoonLordDefeated: I've been told this land is ruled by three gnomes in a suit of armor. That's impossible! Gnomes are the most deplorable customers I've dealt with. They can't handle a spoon without snapping it in half!! It's always the halflings... + } +} + TownPiggy: { DisplayName: Town Piggy Census.SpawnCondition: Use The Housing Contract @@ -606,9 +607,4 @@ TownPiggy: { } } -DraconicSwarmer.DisplayName: Draconic Swarmer -Dragonfolly.DisplayName: Dragonfolly -Shoreskipper.DisplayName: Shoreskipper -BrainIllusion.DisplayName: Brain Illusion -FalseBrain.DisplayName: False Brain -BloodBomb.DisplayName: Blood Bomb +HorribleHog.DisplayName: Horrible Hog diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 87c74c3ceb..86835a2723 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -48,7 +48,6 @@ CataclysmicFlame.DisplayName: Cataclysmic Flame CatastrophicCinder.DisplayName: Catastrophic Cinder CirclingBloodScythe.DisplayName: Circling Blood Scythe CrimsonEye.DisplayName: Crimson Eye -CrimulanSpike.DisplayName: Crimulan Spike CursedFire.DisplayName: Eye Fire DarkEnergyBall.DisplayName: Dark Energy DarkEnergyBall2.DisplayName: Dark Energy diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 4f2e7b90d0..800b3e48a8 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -19,6 +19,14 @@ GammaAcid.DisplayName: Acid GammaBeam.DisplayName: Gamma Ray GammaRayBurst.DisplayName: G-FUEL BEAM GhostBellShock.DisplayName: Electrical Field +HorribleHogChargeHitbox.DisplayName: Horrible Hog +HorribleHogRubble.DisplayName: Rubble +HorribleHogShockwave.DisplayName: Sinister Swine Shockwave +HorribleHogShockwaveSpawner.DisplayName: Horrible Hog Shockwave Spawner +HorribleHogVomitBomb.DisplayName: Barf Bomb +HorribleHogVomitChunk.DisplayName: Horrible Hog's Leftovers +HorribleHogVomitEye.DisplayName: Regurgitated Demon Eye +HorribleHogZombieSpawner.DisplayName: Horrible Hog Zombie Spawner HorsPoisonBlast.DisplayName: Poisonous Spit HorsWaterBlast.DisplayName: Water IceClasperEnemyProjectile.DisplayName: Ice Shard diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 460f796ac8..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.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson index 1add4e568b..fc30ef1be4 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson @@ -2,6 +2,7 @@ Akato.DisplayName: Akato Astrophage.DisplayName: Astrophage BabyGhostBell.DisplayName: Baby Ghost Bell Bear.DisplayName: Bear +Beldum.DisplayName: Beldum BendyPet.DisplayName: Dreamfog Dragon BrimlingPet.DisplayName: Brimling ChibiiDoggo.DisplayName: Chibii Devourer diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index c1aea2de59..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,12 +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 228285a23b..44c29118dc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -258,6 +258,7 @@ SeraphimAngelicLight2.DisplayName: Light Orb SeraphimBeamLarge.DisplayName: Holy Beam SeraphimDagger.DisplayName: Seraphim SeraphimProjectile.DisplayName: Seraphim +ShadySalesmanGunshot.DisplayName: Elephant-Killing Round ShatteredExplosion.DisplayName: Shattered Dawn Blast ShatteredDawnKnife.DisplayName: Shattered Dawn ShatteredDawnScorchedBlade.DisplayName: Scorched Blade @@ -271,6 +272,7 @@ 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 @@ -344,3 +346,5 @@ 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 cb32d297b4..121827ff82 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -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 cbe6fca08b..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 @@ -145,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 @@ -160,10 +162,6 @@ TrustyOldBobber.DisplayName: Trusty Old Bobber UrsaSlash.DisplayName: Ursa Slash V8000SoulVisual.DisplayName: V8000 Soul VerstaltiteBobber.DisplayName: Verstaltite Bobber -VictideBarrier.DisplayName: Tidal Barrier -VictideBobber.DisplayName: Snail Bobber -VictideSeaSnail.DisplayName: Sea Snail -VictideSpirit.DisplayName: Bubbly Spirit VoidFieldGenerator.DisplayName: Void Field Generator VolcanicSandBallFalling.DisplayName: Volcanic Sand Ball VolcanicSandBallGun.DisplayName: Volcanic Sand Ball @@ -178,5 +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.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index ba47bbc760..4f5acca788 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -87,6 +87,9 @@ HolyInferno: "{0} was incinerated by the profaned backdraft." Laceration1: "{0} was indecently smeared all over the walls." Laceration2: "{0} was turned into a fine red mist." Laceration3: "{0} was pulped, ribbons and rivulets of spent life spattering freely." +Lemonnade1: "{0} had their budget cut." +Lemonnade2: "{0} was sent to the vitrified sector." +Lemonnade3: "{0} suffered from self-inflicted domestic arson." ManaBurn: "{0}'s life was completely converted into mana." ManaConversionEnchant: "{0}'s life was fully tapped by dark magics." MiracleBlight1: "{0} was blown away by miraculous technological advancements." diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index a88b068345..db6bd40940 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -6,6 +6,7 @@ Ribs: Ribs Stalagmite: Stalagmite Stalactite: Stalactite PirateCrate: Abandoned Crate +IronBall: Iron Ball // Basic Calamity Furniture Basin: Basin LavaFountain: Lava Fountain diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 92531f5615..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..c51e9e1dad 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -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 d51df64d71..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: ''' @@ -174,7 +175,6 @@ EditedTooltip: { RifleScope1: Increase view range for guns ( to zoom out) RifleScope2: The scope effect can be toggled with visibility ReconScope1: 15% increased ranged damage - ReconScope2: 5% increased ranged critical strike chance SniperScope: 12% increased ranged critical strike chance Magiluminescence: ''' @@ -296,7 +296,7 @@ ClothierChat: { } CyborgChat: { - MoonLordDefeated1: Always shoot for the moon! It has clearly worked before. + 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. } 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/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/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 e43278356b..cd0624330d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -93,9 +93,6 @@ namespace CalamityMod.NPCs { #region Variables - /// Data structure used for storing Calamity's intended boss kill times. - public static SortedDictionary BossKillTimes; - /// Data structure used for storing the damage reduction values of NPCs. public static SortedDictionary DRValues { get; set; } @@ -270,16 +267,6 @@ namespace CalamityMod.NPCs public float manaBurn = 0f; public float manaBurnPeak = 0f; public float playerManaBurnIntensity = 0f; - /// - /// Counter variable that increments while the NPC is inflicted with Pearl Aura.
- /// Used to determine when Giant Pearl's pearl shards should rain down onto the NPC. - ///
- public int pearlAuraCounter = 0; - /// - /// When an NPC is inflicted with Pearl Aura, this variable is set to index of the player who inflicted it.
- /// Used for properly counting pearl shard amount and for giving pearl shards an owner. - ///
- public int pearlAuraOwner = -1; public bool burningBlood = false; public bool brainRot = false; public bool heavyBleeding = false; @@ -401,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; @@ -563,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; @@ -647,8 +631,6 @@ namespace CalamityMod.NPCs myClone.windChilled = windChilled; myClone.ashesOnDeath = ashesOnDeath; - myClone.fortunesFavor = fortunesFavor; - // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; myClone.ManaBurnFireDrawer = null; @@ -815,8 +797,6 @@ namespace CalamityMod.NPCs if (ashesOnDeath > 0) ashesOnDeath--; - fortunesFavor = false; - if (antlionCloudDebuffTimer > 0) antlionCloudDebuffTimer--; if (cursorFocus > 0 && cursorFocus < cursorFocusMax) @@ -876,6 +856,7 @@ namespace CalamityMod.NPCs ActiveSicknessDebuffMultiplier = SicknessDebuffMultiplier; ActiveElectricDebuffMultiplier = ElectricDebuffMultiplier; ActiveWaterDebuffMultiplier = WaterDebuffMultiplier; + ActiveTypelessDebuffMultiplier = TypelessDebuffMultiplier; if (irradiated) { @@ -902,7 +883,7 @@ namespace CalamityMod.NPCs { ActiveWaterDebuffMultiplier += 0.5f; } - if (npc.buffType.Any(i => BuffDatasets.DebuffDataset[i] is not null && BuffDatasets.DebuffDataset[i].WaterDebuffScaling > 0) || npc.wet || npc.honeyWet || npc.dripping) + 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; } @@ -945,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); @@ -1015,7 +991,7 @@ namespace CalamityMod.NPCs int dmg = 0; if (glaiveShredTimer > 0) { - dmg += 120; // 60 DPS + dmg += 200; // 100 DPS glaiveShredTimer--; } if (blazingStarShredTimer > 0) @@ -1076,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; @@ -1216,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) @@ -2795,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. @@ -2871,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) @@ -3332,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); @@ -3523,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) @@ -3666,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; @@ -3853,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; @@ -3930,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())) { @@ -3964,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. @@ -3982,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); } } @@ -4375,7 +4207,7 @@ namespace CalamityMod.NPCs } } - public static void AttemptToSpawnLavaNPCs(Player player) + /*public static void AttemptToSpawnLavaNPCs(Player player) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -4407,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) @@ -4421,7 +4252,7 @@ namespace CalamityMod.NPCs } } } - } + }*/ public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { @@ -4729,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); @@ -5146,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/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 409ca846b9..2dd74d7cb7 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -113,6 +113,7 @@ namespace CalamityMod.NPCs "Johnny Test", // <@!589966747977777197> (konorango) "Bling Bling Boy", // <@!522970788203069442> (phallguy) "RICE", // <@!400107830889152524> (rice_xd.) + "Quest Boy", // <@!770103186093637663> (justanothersoldiermain) ]; private static readonly string[] ArmsDealerNames = [ @@ -132,13 +133,14 @@ namespace CalamityMod.NPCs "Storm Havik", // <@!1013452363178197072> (fishnotduck) "Magorfis Splunt the Greater Finklejim", // <@!147490809334333440> (eidolbyssus) "Perrin", // <@!253764551139393537> (easyperrin) - "Dorkyy", // <@!427765391662514185> (dorkblaze01) + "Spud McGee", // <@!727111000658018326> (starchman) ]; private static readonly string[] CyborgNames = [ "Sylux", // <@!331812782183809025> (gonkachino) "Nemesis", // <@!1104036024063107082> (yashimayamanata) "Univerze", // <@!1256376346536448150> (unizumi02) + "Hunk", // <@!447597886260248578> (bagel_san) ]; private static readonly string[] DemolitionistNames = [ @@ -172,6 +174,8 @@ namespace CalamityMod.NPCs "Bars Boldia", // <@!332989575708540939> (careless_imp) "Basel Raiden John Clive Fantasy 16", // <@!529392083136413696> (raiden_ii) "Gobby, Destroyer of Wallets", // <@!429024941296582658> (bwlstorm) + "Potential Man", // <@!320787277007552512> (veruze) + "Donny G", // <@!308736236523225088> (donnyg66) ]; private static readonly string[] GolferNames = null; private static readonly string[] GuideNames = @@ -195,6 +199,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 = [ @@ -217,6 +222,8 @@ namespace CalamityMod.NPCs "Fanny", // <@!799749125720637460> (zombiewolf511) "Mausi", // <@!194156349347594241> (sadouken) "Fiona", // <@!475216964168450048> (thatgayguy69) + "Tikoh", // <@!618149904224616458> (r.fractal) + "Vivienne", // <@!1043188879185952848> (thanat.oshi) ]; private static readonly string[] PainterNames = [ @@ -228,6 +235,7 @@ namespace CalamityMod.NPCs "Arin", // <@!268169458302976012> (kiyotu) "Typhäne", // <@!222064016107896832> (typhane.) "Charlotte Linlin", // <@!563406464522125323> (vixcalibur) + "Shmizzle Dizzle", // <@!1070551501283528724> (shmizzledizzle) ]; private static readonly string[] PirateNames = [ @@ -264,6 +272,9 @@ namespace CalamityMod.NPCs "Papyrus Undertale", // <@!262663471189983242> (nycro) "Mr. Bones", // <@!359215912856977408> (jaybones.) "Freakbob", // <@!377863128140087296> (jevilamv) + "Bone Cold Steve Austin", // <@!282704860992897024> (raendrag_of_rovan) + "Them Bones", // <@!322208584534589450> (dogvtf) + "Deep-Vein Thrombonesis", // <@!557473830457704458> (thessyll) ]; private static readonly string[] SteampunkerNames = [ @@ -275,6 +286,7 @@ namespace CalamityMod.NPCs "Kreutz", // <@!553445849149997056> (red_r_kreutz) "Cathlyn", // <@!156672312425316352> (xaqult) "Eunice", // <@!358376627400605699> (srmg267) + "Zera", // <@!543914166969172106> (zer0_0_0_0) ]; private static readonly string[] StylistNames = [ @@ -282,9 +294,9 @@ namespace CalamityMod.NPCs "Faith", // <@!509050283871961123> (toasty1007) "Xsiana", // <@!625780237489143839> (lokistic) "Lain", // <@!655201622863118337> (literallyadeerfr) - "Hamis", // <@!608455754093035521> (haefer) "Brio Scarlet", // <@!358576903701004289> (brio_scarlet) "Vanessa", // <@!638901548591611945> (mediocreking) + "Melanie", // <@!356115964800139267> (schwarzerhumor) ]; private static readonly string[] TavernkeepNames = [ @@ -298,6 +310,7 @@ namespace CalamityMod.NPCs "Emmett", "Bagman", // <@!701831892990820383> (supportcrispy) "Old Man Scrooge", // <@!1392141158255427655> (vortexgaming18) + "Jerry Atric", // <@!181545975901454337> (halleyvetica) ]; private static readonly string[] TravelingMerchantNames = [ @@ -307,6 +320,8 @@ namespace CalamityMod.NPCs "Postman Hiss", // <@!454638106122125312> (karinthefairy) "Cosmoec", // <@!793660591449309204> (cosmoecark) "Junorism", // <@!740625002596008036> (hewhoshallnotbebaned) + "Koral", // <@!1354908256681590845> (koral12244_) + "Phantom", // <@!1360706992506667241> (phantomz980) ]; private static readonly string[] TruffleNames = [ @@ -323,6 +338,7 @@ namespace CalamityMod.NPCs "Amnesia Wapers", // <@!326821498323075073> (retardedadvicefromaretard) "Tequila", // <@!889175547744239677> (thecrispistofnuggets) "Bee Movie Script", // <@!407949998173454341> (literally_jesuschrist) + "Which Doctor", // <@!746103484017016832> (sepulchre0001) ]; private static readonly string[] WizardNames = [ @@ -337,6 +353,7 @@ namespace CalamityMod.NPCs "Mike Cyclops", // <@!702327497475227741> (seichoseicho) "Derin", // <@!466703979695308820> (god_15) "Umbara", // <@!450062421294579712> (umbaraeclipse) + "Reyloth Grey", // <@!255043013116428298> (pantyslack) ]; private static readonly string[] ZoologistNames = [ @@ -347,11 +364,16 @@ namespace CalamityMod.NPCs "Gwenhwyvar", // <@!291342874497515531> (diamondnife) "Daxie", // <@!465438861103988737> (daxie626) "Zora", // <@!752687500656640030> (oxytoxy365) + "Summer", // <@!608455754093035521> (haefer) + "Foxy", // <@!602954046332207164> (squid_san) ]; // Town Slimes private static readonly string[] ClumsySlimeNames = null; private static readonly string[] CoolSlimeNames = null; - private static readonly string[] DivaSlimeNames = null; + private static readonly string[] DivaSlimeNames = + [ + "Rise Kujikawa", // <@!630100236689342475> (roald27) + ]; private static readonly string[] ElderSlimeNames = null; private static readonly string[] MysticSlimeNames = null; private static readonly string[] NerdySlimeNames = @@ -377,6 +399,7 @@ namespace CalamityMod.NPCs "Ozymandias", // <@!146333264871686145> (ozzatron) "Miss Throws a Lot", // <@!799345607847182400> (oakhamsam) "Brikwilla", // <@!543803736909414438> (lavendercobra) + "Melody", // <@!1030635650963214446> (weisslerren) ]; private static readonly string[] TownDogLabradorNames = [ @@ -387,6 +410,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogPitBullNames = [ "Splinter", // <@!320320801213775873> (kaimonick) + "Mack", // <@!427765391662514185> (dorkblaze01) ]; private static readonly string[] TownDogBeagleNames = [ @@ -401,6 +425,7 @@ namespace CalamityMod.NPCs [ "Yoshi", // <@!541127291426832384> (gregthespinarak) "Franklin", // <@!338315261352476682> (tyeski) + "Rocco", // <@!682411821067796480> (little_one777) ]; private const int TownCatSiameseVanillaNames = 12; @@ -417,6 +442,7 @@ namespace CalamityMod.NPCs "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) "Octo", // <@!796112889353994281> (octolinggrimm) + "Kreska", // <@!130037366852157440> (nuclearnecro) ]; private static readonly string[] TownCatSiameseNames = [ @@ -464,7 +490,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; @@ -1234,7 +1263,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; } @@ -1301,8 +1330,7 @@ namespace CalamityMod.NPCs 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) @@ -1384,8 +1412,7 @@ namespace CalamityMod.NPCs { shop.AddWithCustomValue(ItemID.PainterPaintballGun, Item.buyPrice(gold: 15)) .Add(ItemType()) - .Add(ItemType()) - .Add(ItemType(), CalamityConditions.InSunken, Condition.NpcIsPresent(NPCType())); + .Add(ItemType()); } if (type == NPCID.Steampunker) @@ -1443,7 +1470,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) 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/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 7af0156548..2d45fb0d1d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 225; // 450 + NPC.damage = 235; // 470 NPC.npcSlots = 5f; NPC.width = 104; NPC.height = 104; 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..adf0afd2fa 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); + + 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..68cacea0b3 --- /dev/null +++ b/NPCs/NormalNPCs/PiggyGold.cs @@ -0,0 +1,47 @@ +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.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/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 6ed76faa1a..9b57b63963 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -1860,6 +1860,12 @@ namespace CalamityMod.NPCs.OldDuke public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (NPC.IsABestiaryIconDummy) + { + NPC.alpha = 0; + return true; + } + Color finalDrawColor = Color.Lerp(drawColor, Color.White, NuclearOverlayVisual); Color overlayDrawColor = Color.Lerp(Color.Transparent, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual); finalDrawColor = Color.Lerp(finalDrawColor, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual); diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index 3db309786d..57b1ff8105 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -584,7 +584,6 @@ namespace CalamityMod.NPCs.Other { double pisquaredover6 = Math.Pow(MathHelper.Pi, 2) / 6; npcLoot.Add(ModContent.ItemType()); - npcLoot.Add(ModContent.ItemType(), 1, 22, (int)(pisquaredover6 * 100)); } } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 39a7dc5f10..7bbc1a0e1c 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -834,22 +834,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; @@ -881,7 +875,6 @@ namespace CalamityMod.NPCs.Providence // Velocity and acceleration float speedIncreaseTimer = fullPowerAI ? 75f : death ? 120f : 150f; - bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer; float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; @@ -893,14 +886,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) @@ -1950,7 +1937,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; 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/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs deleted file mode 100644 index a427360771..0000000000 --- a/NPCs/SunkenSea/AlphaSeaMinnow.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class AlphaSeaMinnow : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Flee = 1 - } - - public ref float CurrentBehavior => ref NPC.ai[1]; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 100; - public static int IdleMaxPathDistance = 1200; - - public static int FleeTileAnticipationDistance = 64; - - public Vector2 randomPathPoint; - - public bool instantiated = false; - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 8; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.npcSlots = 0.5f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 40; - NPC.height = 32; - NPC.defense = 0; - NPC.lifeMax = 5; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - NPC.chaseable = false; - NPC.catchItem = (short)ModContent.ItemType(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AlphaSeaMinnow") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // Alphas released by the player do not spawn a shoal of minnows - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - NPC.TargetClosest(false); - // Spawn a shoal of minnows - int fishCount = Main.rand.Next(2, 7); - // More spawn in the Radiant Reefs - if (NPC.HasPlayerTarget) - { - if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - fishCount += 3; - } - for (int i = 0; i < fishCount; i++) - { - int goldchance = NPC.type == ModContent.NPCType() ? 20 : 50; - int minnowtype = Main.rand.NextBool(goldchance) ? ModContent.NPCType() : ModContent.NPCType(); - int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, minnowtype); - Main.npc[n].ai[2] = NPC.whoAmI; // makes the spawned minnow recognize this one as the alpha - } - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.6f; - MaxSpeed = 4f; - } - if (NPC.wet) - { - switch (CurrentBehavior) - { - case (int)PhaseType.Idle: - IdleBehavior(); - break; - case (int)PhaseType.Flee: - FleeBehavior(); - break; - } - } - else - { - BeachedBehavior(); - } - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - if (NPC.type == ModContent.NPCType()) - { - NPC.ProduceGoldCritterDust(); - } - } - - public void IdleBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - - public void FleeBehavior() - { - // If the predator is gone, go back to idling. - if (CurrentPredator == null) - { - CurrentBehavior = (int)PhaseType.Idle; - MaxSpeed = 4f; - return; - } - - MaxSpeed = 8f; - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - Point lookAheadPosition = (NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates(); - if (!CalamityUtils.ParanoidTileRetrieval(lookAheadPosition.X, lookAheadPosition.Y).IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - - public void BeachedBehavior() - { - if (NPC.velocity.Y == 0f) - { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) - { - NPC.velocity.X = 0f; - } - } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) - { - NPC.velocity.Y = 10f; - } - NPC.ai[0] = 1f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = (int)PhaseType.Flee; - } - - public override void ModifyTypeName(ref string typeName) - { - // Holy mackerel is that an Ultrakill reference!?!? - // (I have barely played the game as of writing this _ YuH) - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.MinnowPrime"); - } - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - { - NPC.frameCounter = 0.0; - return; - } - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "AlphaSeaMinnow", 2); - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - } - public class AlphaSeaMinnowGold : AlphaSeaMinnow - { - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - base.SetStaticDefaults(); - } - public override void SetDefaults() - { - base.SetDefaults(); - NPC.rarity = 3; - NPC.catchItem = ModContent.ItemType(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.2f; - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; - - } - return 0f; - } - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } - } - } -} diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.png b/NPCs/SunkenSea/AlphaSeaMinnow.png deleted file mode 100644 index 46d9558e2f..0000000000 Binary files a/NPCs/SunkenSea/AlphaSeaMinnow.png and /dev/null differ diff --git a/NPCs/SunkenSea/AlphaSeaMinnowGold.png b/NPCs/SunkenSea/AlphaSeaMinnowGold.png deleted file mode 100644 index 97bcba564f..0000000000 Binary files a/NPCs/SunkenSea/AlphaSeaMinnowGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 8d45a19a5f..a2c9132f7a 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -1,73 +1,34 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Accessories; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; - namespace CalamityMod.NPCs.SunkenSea { - public class BabyGhostBell : SunkenSeaNPC + public class BabyGhostBell : ModNPC { public bool hasBeenHit = false; - public static Asset RadiantTexture; - public static Asset VoltaicTexture; - public static Asset PinkTexture; - public static Asset GreenTexture; - public static Asset GoldTexture; - public ref float Variant => ref NPC.ai[1]; - public enum JellyColor - { - Blue = 0, - Green = 1, - Pink = 2, - Radiant = 3, - Voltaic = 4, - Gold = 5 - } - /// - /// The squish of this NPC while drawing. - /// - private Vector2 ScaleSquish = Vector2.One; - - // keeps track of the number of hops between a flip - public int flipCounter; - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List(); - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows; - - public override void Load() - { - RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRadiant"); - VoltaicTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellVoltaic"); - GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGreen"); - PinkTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellPink"); - GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGold"); - } + public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 6; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; + Main.npcFrameCount[NPC.type] = 4; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -75,7 +36,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.chaseable = false; - NPC.dontTakeDamageFromHostiles = true; NPC.aiStyle = -1; AIType = -1; NPC.damage = 0; @@ -84,12 +44,13 @@ namespace CalamityMod.NPCs.SunkenSea NPC.defense = 0; NPC.lifeMax = 5; NPC.knockBackResist = 1f; - NPC.alpha = 75; + NPC.alpha = 100; NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -112,58 +73,6 @@ namespace CalamityMod.NPCs.SunkenSea hasBeenHit = reader.ReadBoolean(); } - public override void OnSpawn(IEntitySource source) - { - // Bells released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - Variant = Main.rand.Next(0, 3); - if (Main.rand.NextBool(30)) - { - Variant = (int)JellyColor.Radiant; - } - if (Main.rand.NextBool(15)) - { - Variant = (int)JellyColor.Voltaic; - } - if (Main.rand.NextBool(50)) - { - Variant = (int)JellyColor.Gold; - } - switch (Variant) - { - case (int)JellyColor.Blue: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)JellyColor.Green: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)JellyColor.Pink: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)JellyColor.Radiant: - { - NPC.catchItem = ModContent.ItemType(); - NPC.rarity = 3; - } - break; - case (int)JellyColor.Gold: - { - NPC.catchItem = ModContent.ItemType(); - NPC.rarity = 3; - } - break; - case (int)JellyColor.Voltaic: - { - NPC.catchItem = ModContent.ItemType(); - NPC.rarity = 3; - } - break; - } - } - public override void AI() { if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -187,113 +96,22 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - - // Reset any squish that is done to the Ghost Bells, and clamps its upper limit to prevent it from becoming too tall - if (ScaleSquish.Y > 1f) - ScaleSquish.Y = MathHelper.Clamp(ScaleSquish.Y, 1f, 1.5f); - ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); - - // Quick lil hops in semi-random directions for movement. its thursday + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1f / 255f, (255 - NPC.alpha) * 1f / 255f); if (NPC.wet) { - NPC.height = (int)(36 * NPC.scale); - if (NPC.velocity.Length() < 0.5f) + NPC.noGravity = true; + if (NPC.velocity.Y < 0f) { - // stretch a bit for ~ effect ~ - ScaleSquish.Y += 0.4f; - - // get a semi-random float that is equivalent to +- X (normalised) degrees around the current rotation - float semiRandomAngle = Main.rand.NextFloat(-0.7f, 0.7f); - // multiply velocity by a random amount to break up cycles and appear more natural - NPC.velocity *= Main.rand.NextFloat(12f, 15f); - // check if the velocity lands itself into a tile - bool bonk = CalamityUtils.DistanceToTileCollisionHit(NPC.position, NPC.velocity, 9) != null; - - // random chance if the last direction flip was 3+ hops ago OR if the ghost bell is about to bonk a tile - if ((flipCounter >= 3 && Main.rand.NextBool(6)) || bonk) - { - // send it in the opposite direction - NPC.velocity *= -1; - NPC.velocity = NPC.velocity.RotatedBy(semiRandomAngle); - flipCounter = 0; // reset the counter - //Main.NewText("flip! " + flipCounter + " " + NPC.velocity + " " + NPC.rotation); - } - else - { - // send it in a random direction - NPC.velocity = NPC.velocity.RotatedBy(semiRandomAngle); - ++flipCounter; // add to the counter - //Main.NewText("swim, " + flipCounter + " " + NPC.velocity + " " + NPC.rotation); - } + NPC.velocity.Y += 0.1f; } - NPC.velocity *= 0.95f; - NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.5f); - - if (NPC.velocity == Vector2.Zero) + if (NPC.velocity.Y > 0f) { - // failsafe. turns out they love getting themselves stuck in walls, so this is necessary to prevent that - NPC.velocity = Main.rand.NextVector2CircularEdge(8, 8); + NPC.velocity.Y = 0f; } } else { - // wouldnt want it flipping back into the air immediately, would we? - flipCounter = 0; - // Height is changed so that the jelly looks like it's actually laying on the ground when rotated - NPC.height = (int)(24 * NPC.scale); - // Gravy - if (NPC.velocity.Y < 10) - { - NPC.velocity.Y += 0.5f; - } - // Once it has hit the ground, fall over - if (Math.Abs(NPC.velocity.Y) < 1 && NPC.collideY) - { - // Splat - if (NPC.ai[2] == 0) - { - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, NPC.Center); - NPC.ai[2] = 1; - } - NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.7f); - } - // Reset the splat sound - else - { - NPC.ai[2] = 0; - } - } - // Lite - Color lightColor = Color.LightBlue; // Voltaic uses the same light blue - switch (Variant) - { - case (int)JellyColor.Pink: - lightColor = Color.Pink; - break; - case (int)JellyColor.Green: - lightColor = Color.LightGreen; - break; - case (int)JellyColor.Radiant: - lightColor = Color.LightBlue * 1.1f; // Radiant glows brighter - break; - } - Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); - - if (Variant == (int)JellyColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (Variant == (int)JellyColor.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantBabyGhostBell"); - } - if (Variant == (int)JellyColor.Gold) - { - typeName = CalamityUtils.GetTextValue("NPCs.GoldBabyGhostBell"); + NPC.noGravity = false; } } @@ -309,79 +127,50 @@ namespace CalamityMod.NPCs.SunkenSea public override void FindFrame(int frameHeight) { NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 1.5f; } return 0f; } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } + public override void HitEffect(NPC.HitInfo hit) { - int dustType = DustID.BlueCrystalShard; - switch (Variant) - { - case (int)JellyColor.Pink: - dustType = DustID.PinkTorch; - break; - case (int)JellyColor.Green: - dustType = DustID.GemEmerald; - break; - case (int)JellyColor.Gold: - dustType = DustID.GoldCritter; - break; - } for (int k = 0; k < 2; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[Type].Value; - switch (Variant) - { - case (int)JellyColor.Pink: - texture = PinkTexture.Value; - break; - case (int)JellyColor.Green: - texture = GreenTexture.Value; - break; - case (int)JellyColor.Radiant: - texture = RadiantTexture.Value; - break; - case (int)JellyColor.Voltaic: - texture = VoltaicTexture.Value; - break; - case (int)JellyColor.Gold: - texture = GoldTexture.Value; - break; - } - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[Type] / 2); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, ScaleSquish, spriteEffects, 0f); - - return false; - } } } diff --git a/NPCs/SunkenSea/BabyGhostBell.png b/NPCs/SunkenSea/BabyGhostBell.png index 798cf525ee..ee927c6bed 100644 Binary files a/NPCs/SunkenSea/BabyGhostBell.png and b/NPCs/SunkenSea/BabyGhostBell.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGlow.png b/NPCs/SunkenSea/BabyGhostBellGlow.png new file mode 100644 index 0000000000..ee927c6bed Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellGlow.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGold.png b/NPCs/SunkenSea/BabyGhostBellGold.png deleted file mode 100644 index 198d7a739d..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellGreen.png b/NPCs/SunkenSea/BabyGhostBellGreen.png deleted file mode 100644 index aa7ee07608..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellPink.png b/NPCs/SunkenSea/BabyGhostBellPink.png deleted file mode 100644 index 46093d1e35..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellRadiant.png b/NPCs/SunkenSea/BabyGhostBellRadiant.png deleted file mode 100644 index 701a3c69bc..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellVoltaic.png b/NPCs/SunkenSea/BabyGhostBellVoltaic.png deleted file mode 100644 index a0d92340e2..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellVoltaic.png and /dev/null differ diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs new file mode 100644 index 0000000000..7d43671bd6 --- /dev/null +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -0,0 +1,150 @@ +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class BlindedAngler : ModNPC + { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 150; + NPC.width = 56; + NPC.height = 44; + NPC.defense = 30; + NPC.lifeMax = 750; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.1f; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlindedAngler") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + { + return NPC.chaseable; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 5, 9); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/BlindedAngler.png b/NPCs/SunkenSea/BlindedAngler.png new file mode 100644 index 0000000000..afdae09734 Binary files /dev/null and b/NPCs/SunkenSea/BlindedAngler.png differ diff --git a/NPCs/SunkenSea/BlindedAnglerGlow.png b/NPCs/SunkenSea/BlindedAnglerGlow.png new file mode 100644 index 0000000000..c38e496699 Binary files /dev/null and b/NPCs/SunkenSea/BlindedAnglerGlow.png differ diff --git a/NPCs/SunkenSea/CarrionSwallower.cs b/NPCs/SunkenSea/CarrionSwallower.cs deleted file mode 100644 index 73c9da2325..0000000000 --- a/NPCs/SunkenSea/CarrionSwallower.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System.IO; -using CalamityMod.BiomeManagers; -using CalamityMod.Dusts; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class CarrionSwallower : ModNPC - { - public ref float Timer => ref NPC.ai[0]; - public ref float AttackState => ref NPC.ai[1]; - public ref float ExtraTimer => ref NPC.ai[2]; - public ref float PusAmount => ref NPC.ai[3]; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 20f }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.width = 50; - NPC.height = 42; - NPC.lifeMax = 65; - NPC.damage = 25; - NPC.defense = 0; - NPC.knockBackResist = 0f; - NPC.HitSound = SoundID.DD2_SkeletonHurt; - NPC.DeathSound = SoundID.DD2_SkeletonDeath; - NPC.noGravity = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange( - [ - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CarrionSwallower") - ]); - } - - public override void AI() - { - NPC.TargetClosest(false); - Player target = Main.player[NPC.target]; - NPC.spriteDirection = NPC.direction; - - // Passive when first spawned - if (NPC.localAI[0] == 0f) - { - NPC.damage = 0; - PusAmount = 3; - NPC.velocity.X = 5f * NPC.direction; - if (NPC.velocity.X == 0f) - NPC.direction = -NPC.direction; - - // Attack if get too close - if (target.Distance(NPC.Center) < 320f) - { - NPC.localAI[0] = 1f; - NPC.netUpdate = true; - } - } - // Attacking - else - { - NPC.direction = (NPC.velocity.X > 0f).ToDirectionInt(); - Timer++; - // Sac full - if (AttackState == 0f) - { - NPC.damage = 0; - if (Timer < 180f || (target.Distance(NPC.Center) > 400f && ExtraTimer == 0f)) - { - Vector2 targetDirection = Utils.DirectionTo(NPC.Center, target.Center); - NPC.velocity = (NPC.velocity * 55f + targetDirection * 7f) / 56f; - } - else - { - ExtraTimer++; - NPC.velocity *= 0.975f; - // Fire pus at the player - if (ExtraTimer == 40f) - { - SoundEngine.PlaySound(SoundID.NPCHit10, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 spawn = NPC.Center + Vector2.UnitX * 13f * NPC.spriteDirection; - Projectile.NewProjectile(NPC.GetSource_FromThis(), spawn, Utils.DirectionTo(spawn, target.Center) * 10f, ModContent.ProjectileType(), 12, 0f, Main.myPlayer); - } - - Timer = 0f; - ExtraTimer = 0f; - // Starts with 3 shots, after firing them all the sac empties and it switches to charge mode - PusAmount--; - if (PusAmount == 0) - AttackState = 1f; - } - else // Dust telegraph - { - Vector2 dustSpawn = NPC.Center + Vector2.UnitX * 20f * NPC.direction * NPC.scale; - Vector2 dustVel = (Vector2.UnitX * 3f).RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextBool().ToDirectionInt(); - Dust dust = Dust.NewDustPerfect(dustSpawn, ModContent.DustType(), dustVel, 100, Main.rand.NextBool() ? Color.Yellow : Color.DarkRed, 0.6f); - dust.noLightEmittence = true; - } - } - } - // Sac empty - else - { - if (Timer < 180f || (target.Distance(NPC.Center) > 320f && ExtraTimer == 0f)) - { - Vector2 targetDirection = Utils.DirectionTo(NPC.Center, target.Center); - NPC.velocity = (NPC.velocity * 40f + targetDirection * 10f) / 41f; - } - else - { - ExtraTimer++; - // Charge - if (ExtraTimer == 40f) - { - SoundEngine.PlaySound(SoundID.NPCHit6, NPC.Center); - NPC.damage = NPC.defDamage; - NPC.velocity = Utils.DirectionTo(NPC.Center, target.Center) * 13.5f; - - CustomPulse woosh = new(NPC.Center, Vector2.Zero, Color.DarkRed, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0.1f, 0.6f, 15); - GeneralParticleHandler.SpawnParticle(woosh); - } - else if (ExtraTimer < 40f) - { - Vector2 dustSpawn = NPC.Center + Main.rand.NextVector2CircularEdge(35f, 35f); - Vector2 dustVel = Utils.DirectionTo(dustSpawn, NPC.Center) * 4f + NPC.velocity * 0.75f; - Dust dust = Dust.NewDustPerfect(dustSpawn, ModContent.DustType(), dustVel, 100, Color.DarkRed, 0.6f); - dust.noLightEmittence = true; - } - - NPC.velocity *= ExtraTimer > 60f ? 0.96f : ExtraTimer < 40f ? 0.98f : 1f; - - // Reset - if (ExtraTimer == 70f) - { - NPC.damage = 0; - Timer = 0f; - ExtraTimer = 0f; - if (NPC.localAI[1] == 1f) - { - NPC.localAI[1] = 0f; - AttackState = 0f; - PusAmount = 3; - } - } - } - } - - if (NPC.velocity.X == 0f) - NPC.velocity.X = -NPC.oldVelocity.X * 0.7f; - if (NPC.velocity.Y == 0f) - NPC.velocity.Y = -NPC.oldVelocity.Y * 0.7f; - } - } - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - // This code has to be run in ModifyHitPlayer because otherwise shields prevent it from working - // We don't have to check the AttackState because it only deals contact damage while ramming - // localAI[1] is used a temp set for filling with pus so that the current charge can finish before starting pus shooting mode - NPC.localAI[1] = 1f; - NPC.ForceNetUpdate(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.4f; - } - return 0f; - } - - /*public override void FindFrame(int frameHeight) - { - base.FindFrame(frameHeight); - }*/ - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[Type].Value; - // If in the bestiary or is buffering the pus fill from hitting a charge, draw the sac; otherwise it's based on AttackState - Rectangle frame = tex.Frame(2, 1, NPC.IsABestiaryIconDummy || NPC.localAI[1] == 1f ? 0 : (int)AttackState, NPC.frame.Y); - - spriteBatch.Draw(tex, NPC.Center - screenPos, frame, drawColor, NPC.rotation, frame.Size() / 2f, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - return false; - } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 1, 1, 2); - } - - public override void HitEffect(NPC.HitInfo hit) - { - CalamityUtils.SpawnGores(NPC, "CarrionSwallower", 2); - } - } -} diff --git a/NPCs/SunkenSea/CarrionSwallower.png b/NPCs/SunkenSea/CarrionSwallower.png deleted file mode 100644 index da8e034106..0000000000 Binary files a/NPCs/SunkenSea/CarrionSwallower.png and /dev/null differ diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index d282fb35f8..11e0c19ab5 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -1,17 +1,9 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; +using CalamityMod.Items.Placeables.Banners; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -20,61 +12,13 @@ namespace CalamityMod.NPCs.SunkenSea { public class Clam : ModNPC { - public enum PersonalityTypes - { - Reefs = 0, - Burrows = 1, - Den = 2 - } - - public enum PhaseType - { - Idle = 0, - Attacking = 1, - Squirt = 2, - Pod = 3 - } - - public Player Target => Main.player[NPC.target]; - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - public ref float Personality => ref NPC.ai[3]; - - public ref float ShellRotation => ref NPC.localAI[0]; - - public int originalDamage; - - #region Textures - - public static Asset bottomJawTex; - - public static Asset bottomJawTexAlgae; - - public static Asset bottomJawTexCoral; - - public static Asset algaeTex; - - public static Asset coralTex; - - public static Asset backTex; - #endregion - - public override void Load() - { - backTex = ModContent.Request(Texture + "Back"); - bottomJawTex = ModContent.Request(Texture + "Bottom"); - bottomJawTexAlgae = ModContent.Request(Texture + "BottomAlgae"); - bottomJawTexCoral = ModContent.Request(Texture + "BottomCoral"); - algaeTex = ModContent.Request(Texture + "Algae"); - coralTex = ModContent.Request(Texture + "Coral"); - } + private int hitAmount = 0; + private bool hasBeenHit = false; + private bool statChange = false; public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { SpriteDirection = 1 @@ -84,9 +28,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - originalDamage = NPC.damage = Main.hardMode ? 60 : 30; - NPC.width = 50; - NPC.height = 30; + NPC.damage = Main.hardMode ? 60 : 30; + NPC.width = 56; + NPC.height = 38; NPC.defense = 9999; NPC.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) @@ -95,17 +39,16 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(silver: 5) : Item.buyPrice(silver: 1); + NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit4; - NPC.knockBackResist = 0; + NPC.knockBackResist = 0.05f; Banner = NPC.type; BannerItem = ModContent.ItemType(); - NPC.GravityIgnoresLiquid = true; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[3] { ModContent.GetInstance().Type, ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -118,272 +61,122 @@ namespace CalamityMod.NPCs.SunkenSea public override void SendExtraAI(BinaryWriter writer) { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); + writer.Write(hitAmount); + writer.Write(NPC.chaseable); + writer.Write(hasBeenHit); + writer.Write(statChange); } public override void ReceiveExtraAI(BinaryReader reader) { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.TargetClosest(); - - NPC.direction = Main.rand.NextBool().ToDirectionInt(); - NPC.localAI[1] = Main.rand.Next(0, 4); - - if (Target.Calamity().ZoneClamDen) - Personality = (int)PersonalityTypes.Den; - else if (Target.Calamity().ZoneGleamingBurrows) - Personality = (int)PersonalityTypes.Burrows; - else - Personality = (int)PersonalityTypes.Reefs; + hitAmount = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); + hasBeenHit = reader.ReadBoolean(); + statChange = reader.ReadBoolean(); } public override void AI() { - // Rotation at its peak - float maxRotation = MathHelper.ToRadians(60); - NPC.TargetClosest(false); - // Always be mad during Clamity + NPC.TargetClosest(true); if (Main.player[NPC.target].Calamity().clamity) { - Personality = (int)PersonalityTypes.Burrows; + hitAmount = 3; + hasBeenHit = true; } - switch (CurrentPhase) + if (NPC.justHit && hitAmount < 3) { - case (int)PhaseType.Idle: - { - NPC.damage = 0; - NPC.chaseable = false; - NPC.velocity.X *= 0.9f; - if (ShellRotation > 0) - { - ShellRotation -= 0.2f; - if (ShellRotation < 0) - ShellRotation = 0; - } - else if (ShellRotation < 0) - { - ShellRotation += 0.03f; - if (ShellRotation > 0) - { - ShellRotation = 0; - } - } - switch (Personality) - { - // Aggro immediately - case (int)PersonalityTypes.Den: - { - ChangePhase((int)PhaseType.Attacking); - } - break; - // Aggro if the player is near - case (int)PersonalityTypes.Burrows: - { - if (Target.Distance(NPC.Center) < 600 && NPC.HasSight(Target.Center)) - { - ChangePhase((int)PhaseType.Attacking); - } - } - break; - // Aggro if hurt - default: - { - if (NPC.life < (NPC.lifeMax - 2)) - { - ChangePhase((int)PhaseType.Attacking); - } - } - break; - } - } - break; - case (int)PhaseType.Attacking: - { - NPC.damage = 0; - NPC.knockBackResist = 0.05f; - NPC.defense = Main.hardMode ? 15 : 6; - NPC.chaseable = true; - Timer++; - if (NPC.velocity.Y == 0) - { - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - NPC.velocity.X = 0; - NPC.ai[2]++; - if (NPC.ai[2] > Main.rand.Next(30, 60)) - { - NPC.velocity.Y = -4; - NPC.velocity.X = NPC.direction * 6; - NPC.ai[2] = 0; - } - } - else - { - NPC.damage = originalDamage; - - if (NPC.velocity.Y < 0) - { - ShellRotation += 0.065f; - if (ShellRotation > maxRotation) - ShellRotation = maxRotation; - } - NPC.velocity.X *= 0.99f; - } - - if (NPC.position.Distance(NPC.oldPosition) < 8 && NPC.velocity.Y >= 0) - { - ShellRotation -= 0.065f; - if (ShellRotation < 0) - ShellRotation = 0; - } - - // Squirt - if (Timer > Main.rand.Next(220, 260) && NPC.HasSight(Target.Center) && ShellRotation == 0) - { - ChangePhase((int)PhaseType.Squirt); - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - } - NPC.StepUpBlocks(); - } - break; - case (int)PhaseType.Squirt: - { - NPC.damage = 0; - NPC.chaseable = true; - // Slow down. Once the clam is rested, start incrementing Timer - if (NPC.velocity.Y == 0) - { - NPC.velocity.X *= 0.8f; - // Set ai[2] to 1 - NPC.ai[2] = 1; - } - - // Increment Timer is ai[2] is 1 - if (NPC.ai[2] == 1) - { - Timer++; - } - - // When to start opening - float startOpen = 30; - // When to end opening - float endOpen = startOpen + 30; - // When to start closing - float startClose = endOpen + 20; - // When to stop closing - float endClose = startClose + 5; - // When to go to the next attack - float reset = endClose + 60; - - // Direction the player is relative to the clam - int playerPosition = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - - // Shell animation - if (Timer >= startOpen && Timer <= endOpen) - { - ShellRotation = (float)Utils.AngleLerp(0, maxRotation, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startOpen, endOpen, Timer, true), 0)); - } - else if (Timer >= startClose && Timer <= endClose) - { - ShellRotation = (float)Utils.AngleLerp(maxRotation, 0, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startClose, endClose, Timer, true), 0)); - } - - // Fire the projectile - if (Timer == (endClose - 5)) - { - NPC.damage = originalDamage; - Vector2 velocity = NPC.SafeDirectionTo(Target.Center, Vector2.UnitY) * 5; - - // If the player is on the other side of the clam, flip the jet so that it doesn't fire backwards - if (playerPosition != NPC.direction) - velocity.X *= -1; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), Main.hardMode ? 30 : 15, 1); - } - for (int i = 0; i < 9; i++) - { - GenericBubbleParticle waterFlavored = new GenericBubbleParticle(NPC.Center, Main.rand.NextFloat(16, 22) * velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-45, 45))), Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextFloat(-4, 4), 5); - waterFlavored.AffectedByLight = true; - GeneralParticleHandler.SpawnParticle(waterFlavored); - } - - SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), NPC.Center); - SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), NPC.Center); - } - - // Go back to melee - if (Timer >= reset) - { - ChangePhase((int)PhaseType.Attacking); - } - } - break; - case (int)PhaseType.Pod: - { - NPC.damage = 0; - - NPC.chaseable = true; - NPC pod = Main.npc[(int)NPC.localAI[2] - 1]; - // If the Pearlpod is invalid, go back to idling - if (pod == null || !pod.active || pod.life < 0 || pod.ModNPC == null || pod.ModNPC is not Pearlpod) - { - NPC.localAI[2] = 0; - ChangePhase((int)PhaseType.Idle); - } - else - { - // Face towards the Pearlpod while it's still out - if (pod.Opacity == 1) - NPC.direction = NPC.DirectionTo(pod.Center).X.DirectionalSign(); - // Start closing when the Pearlpod is nearby - if (pod.Distance(NPC.Center) > 30) - { - ShellRotation += 0.05f; - if (ShellRotation > maxRotation) - ShellRotation = maxRotation; - } - // Otherwise open up! - else - { - ShellRotation -= 0.2f; - if (ShellRotation < -0.2f) - ShellRotation = -0.2f; - } - } - } - break; + ++hitAmount; + hasBeenHit = true; } - NPC.spriteDirection = NPC.direction; - } - - public void ChangePhase(int phaseNum, bool resetai2 = true) - { - CurrentPhase = phaseNum; - Timer = 0; - if (resetai2) - NPC.ai[2] = 0; - NPC.netUpdate = true; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return CurrentPhase > 0; + NPC.chaseable = hasBeenHit; + if (hitAmount == 3) + { + if (!statChange) + { + NPC.defense = Main.hardMode ? 15 : 6; + NPC.damage = NPC.defDamage; + statChange = true; + } + if (NPC.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9) + { + NPC.ai[0] = 1f; + NPC.netUpdate = true; + return; + } + NPC.ai[0] = 1f; + NPC.netUpdate = true; + return; + } + } + else if (NPC.velocity.Y == 0f) + { + NPC.ai[2] += 1f; + int decelerationTimer = 20; + if (NPC.ai[1] == 0f) + { + decelerationTimer = 12; + } + if (NPC.ai[2] < (float)decelerationTimer) + { + NPC.velocity.X *= 0.9f; + return; + } + NPC.ai[2] = 0f; + NPC.TargetClosest(true); + if (NPC.direction == 0) + { + NPC.direction = -1; + } + NPC.spriteDirection = -NPC.direction; + NPC.ai[1] += 1f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 4f) + { + NPC.ai[3] = 0f; + if (NPC.ai[1] == 2f) + { + float multiplierX = (float)Main.rand.Next(3, 7); + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -8f; + NPC.ai[1] = 0f; + } + else + { + float multiplierX = (float)Main.rand.Next(5, 9); + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -4f; + } + } + NPC.netUpdate = true; + return; + } + else + { + if (NPC.direction == 1 && NPC.velocity.X < 1f) + { + NPC.velocity.X = NPC.velocity.X + 0.1f; + return; + } + if (NPC.direction == -1 && NPC.velocity.X > -1f) + { + NPC.velocity.X = NPC.velocity.X - 0.1f; + return; + } + } + } + else + NPC.damage = 0; } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return CurrentPhase > 0; + return hasBeenHit; } return null; } @@ -396,7 +189,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (CurrentPhase == 0) + if (hitAmount < 3) { NPC.frame.Y = frameHeight * 4; } @@ -411,16 +204,9 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Water) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water) { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.8f; - - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 1f; - - if (spawnInfo.Player.Calamity().ZoneClamDen) - return SpawnCondition.CaveJellyfish.Chance * 1.2f; + return SpawnCondition.CaveJellyfish.Chance * 1.2f; } return 0f; } @@ -437,14 +223,12 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } - string name = NPC.localAI[1] switch + if (Main.netMode != NetmodeID.Server) { - 1 => "ClamAlgae", - 2 => "ClamCoral", - _ => "Clam" - }; - - CalamityUtils.SpawnGores(NPC, name, 2); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam3").Type, 1f); + } } } @@ -456,42 +240,5 @@ namespace CalamityMod.NPCs.SunkenSea npcLoot.Add(ItemID.PinkPearl, 40); npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 2); } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Texture2D jaw = bottomJawTex.Value; - - switch (NPC.localAI[1]) - { - case 1: - { - tex = algaeTex.Value; - jaw = bottomJawTexAlgae.Value; - } - break; - case 2: - { - tex = coralTex.Value; - jaw = bottomJawTexCoral.Value; - } - break; - } - - Vector2 drawOffset = Vector2.UnitY * 8; - Vector2 topDrawOffset = drawOffset + new Vector2(NPC.spriteDirection * -22, -3); - bool facingRight = NPC.spriteDirection == 1; - if (facingRight) - { - topDrawOffset.X += 6; - } - Vector2 backOffset = topDrawOffset; - float trueShellRotation = ShellRotation * -NPC.spriteDirection; - if (ShellRotation == 0) - spriteBatch.Draw(backTex.Value, NPC.Center - screenPos + backOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(tex, NPC.Center - screenPos + topDrawOffset, null, NPC.GetAlpha(drawColor), trueShellRotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - spriteBatch.Draw(jaw, NPC.Center - screenPos + drawOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - return false; - } } } diff --git a/NPCs/SunkenSea/Clam.png b/NPCs/SunkenSea/Clam.png index acb6f0dd51..f7eb5f074a 100644 Binary files a/NPCs/SunkenSea/Clam.png and b/NPCs/SunkenSea/Clam.png differ diff --git a/NPCs/SunkenSea/ClamAlgae.png b/NPCs/SunkenSea/ClamAlgae.png deleted file mode 100644 index e695d282f8..0000000000 Binary files a/NPCs/SunkenSea/ClamAlgae.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBack.png b/NPCs/SunkenSea/ClamBack.png deleted file mode 100644 index 7eec13a3b9..0000000000 Binary files a/NPCs/SunkenSea/ClamBack.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBottom.png b/NPCs/SunkenSea/ClamBottom.png deleted file mode 100644 index 3d9a5ddeeb..0000000000 Binary files a/NPCs/SunkenSea/ClamBottom.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBottomAlgae.png b/NPCs/SunkenSea/ClamBottomAlgae.png deleted file mode 100644 index c3f133e6c0..0000000000 Binary files a/NPCs/SunkenSea/ClamBottomAlgae.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamBottomCoral.png b/NPCs/SunkenSea/ClamBottomCoral.png deleted file mode 100644 index 103aaa2e63..0000000000 Binary files a/NPCs/SunkenSea/ClamBottomCoral.png and /dev/null differ diff --git a/NPCs/SunkenSea/ClamCoral.png b/NPCs/SunkenSea/ClamCoral.png deleted file mode 100644 index aad2819891..0000000000 Binary files a/NPCs/SunkenSea/ClamCoral.png and /dev/null differ diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index ec0d742125..75655f8fca 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -1,95 +1,56 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; - namespace CalamityMod.NPCs.SunkenSea { - public class EutrophicRay : SunkenSeaNPC + public class EutrophicRay : ModNPC { + public bool hasBeenHit = false; + public static Asset GlowTexture; - public static Asset TailTexture; - public static Asset TailGlowTexture; - #region Fields - protected override List PreyIDs => []; - protected override List PredatorIDs => - [ - ModContent.NPCType(), - ModContent.NPCType(), - //ModContent.NPCType(), - //ModContent.NPCType() - ]; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - - private bool hasBeenHit = false; - private bool shouldAttack => NPC.life < (int)(NPC.lifeMax * 0.6f); - private Entity AttackingEntity; - private Entity AvoidedEntity; - private Action _currentBehavior; - private Action CurrentBehavior - { - get => _currentBehavior; - set - { - if (value != _currentBehavior) - OnBehaviorChange(value); - _previousBehavior = _currentBehavior; - _currentBehavior = value; - } - } - private Action _previousBehavior; - #endregion - - public override void Load() - { - GlowTexture = ModContent.Request(Texture + "Glow"); - TailTexture = ModContent.Request(Texture + "Tail"); - TailGlowTexture = ModContent.Request(Texture + "TailGlow"); - } public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 7; - NPCID.Sets.TrailingMode[Type] = 3; - NPCID.Sets.TrailCacheLength[Type] = 15; - base.SetStaticDefaults(); + Main.npcFrameCount[NPC.type] = 5; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); + value.Position.X += 24f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - base.SetDefaults(); - NPC.width = 54; - NPC.height = 68; - NPC.damage = 20; - NPC.defense = 5; - NPC.lifeMax = 200; - NPC.scale = 0.85f; - - NPC.noGravity = true; - NPC.noTileCollide = false; - NPC.value = Item.buyPrice(silver: 1); + NPC.damage = Main.hardMode ? 50 : 20; + NPC.width = 116; + NPC.height = 36; + NPC.defense = Main.hardMode ? 15 : 5; + NPC.lifeMax = Main.hardMode ? 500 : 200; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath55; NPC.knockBackResist = 0.5f; - Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -105,295 +66,171 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } + public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(this); - MaxSpeed = 4.85f; - Acceleration = 0.5f; - CurrentBehavior = IdleBehavior; - } - - #region AI Functions public override void AI() { - if (pathfinding == null) + NPC.TargetClosest(true); + if (NPC.velocity.X > 0.25f) { - pathfinding = new PathfindingManager(this); - MaxSpeed = 4.85f; - Acceleration = 0.5f; + NPC.spriteDirection = 1; + } + else if (NPC.velocity.X < 0.25f) + { + NPC.spriteDirection = -1; } - CurrentBehavior?.Invoke(); - - // If out of water, act like you're out of water. - if ((NPC.noTileCollide ? !(Collision.WetCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) : !NPC.wet) && CurrentBehavior != OutOfWaterBehavior) - CurrentBehavior = OutOfWaterBehavior; - - // Used for determining if it should run from players. if (NPC.justHit && !hasBeenHit) + { hasBeenHit = true; - NPC.chaseable = hasBeenHit; - - float curRot = NPC.rotation; - float newRot = NPC.velocity.ToRotation() + MathHelper.Pi; - if (Math.Abs(MathHelper.WrapAngle(curRot) - MathHelper.WrapAngle(newRot)) > MathHelper.PiOver4) - { - NPC.rotation = Utils.AngleLerp(curRot, newRot, 0.1f); - } - else - { - NPC.rotation = newRot; - } - } - private void OnBehaviorChange(Action newBehavior) - { - if (newBehavior == OutOfWaterBehavior) - NPC.noGravity = false; - - MaxSpeed = newBehavior == FleeBehavior ? 6.5f : 5f; - } - - private void IdleBehavior() - { - // Don't deal damage while idling. - NPC.damage = 0; - // If inside solid tiles, attempt to get out of them by occasionally bursting in a random direction. - if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - { - if (Main.rand.NextBool(150)) - NPC.velocity = Main.rand.NextVector2CircularEdge(7.5f, 7.5f); - - NPC.velocity *= 0.98f; - } - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(200f, 800f), SunkenSeaTileValidity)); - } - private void AttackBehavior() - { - // Check what specifically the hunted entity is. If there is none, go back to idling. - AttackingEntity = AttackingEntity is NPC ? CurrentPrey : CurrentPlayer; - if (AttackingEntity == null) - { - CurrentBehavior = IdleBehavior; - return; - } - - // Set damage while attacking. Clear idle behavior pathfinding to prevent it continuously trying to return to that path when attacking. - NPC.damage = NPC.defDamage; - pathfinding.ClearResults(); - NPC.noTileCollide = true; - - float maxSpeedX = 8.2f; - float maxSpeedY = 3.2f; - float accelX = 0.25f; - float accelY = 0.3f; - int directionX = (NPC.Center.X < AttackingEntity.Center.X).ToDirectionInt(); - int directionY = (NPC.Center.Y < AttackingEntity.Center.Y).ToDirectionInt(); - - NPC.velocity.X += accelX * directionX; - if (NPC.velocity.X > maxSpeedX) - NPC.velocity.X = maxSpeedX; - if (NPC.velocity.X < -maxSpeedX) - NPC.velocity.X = -maxSpeedX; - - NPC.velocity.Y += accelY * directionY; - if (NPC.velocity.Y > maxSpeedY) - NPC.velocity.Y = maxSpeedY; - if (NPC.velocity.Y < -maxSpeedY) - NPC.velocity.Y = -maxSpeedY; - } - private void FleeBehavior() - { - // Check what specifically the predator is. If there is none, go back to idling. - AvoidedEntity = AvoidedEntity is NPC ? CurrentPredator : CurrentPlayer; - if (AvoidedEntity == null) - { - CurrentBehavior = IdleBehavior; - return; - } - - // If you reach the attack threshold, start attacking. - if (shouldAttack && AvoidedEntity is Player) - { - CurrentBehavior = AttackBehavior; - AttackingEntity = AvoidedEntity; - AvoidedEntity = null; - return; - } - - // Don't deal damage while fleeing. - NPC.damage = 0; - NPC.noTileCollide = true; - - // Flee in a straight line if possible, otherwise pathfind away from the attacker. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(AvoidedEntity.Center) * 64f).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(AvoidedEntity.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, AvoidedEntity.Center); - Vector2 pathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, pathPoint, SunkenSeaTileValidity)); - } - } - private void OutOfWaterBehavior() - { - NPC.damage = 0; - NPC.velocity.X *= 0.985f; - if (NPC.noTileCollide ? (Collision.WetCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) : NPC.wet) - { - NPC.noGravity = true; - CurrentBehavior = _previousBehavior; - } - } - #endregion - - #region Creature Detection and Hit Logic - protected override bool PlayerSearchFilter(Player p) => (Vector2.DistanceSquared(NPC.Center, p.Center) < 262144f && hasBeenHit) || shouldAttack; - protected override bool NPCSearchFilter(NPC n) => Vector2.DistanceSquared(NPC.Center, n.Center) < 102400f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); - protected override void OnPreyDetection(NPC prey) - { - if (CurrentPredator is not null) - { - CurrentBehavior = AttackBehavior; + NPC.damage = NPC.defDamage; NPC.noTileCollide = true; - AttackingEntity = prey; + NPC.noGravity = true; + if (NPC.Center.X < Main.player[NPC.target].Center.X) + { + NPC.ai[0] = 1f; + } + else + { + NPC.ai[0] = 2f; + } } - } - public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = FleeBehavior; - NPC.noTileCollide = false; - AvoidedEntity = predator; - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - protected override void OnPlayerDetection(Player player) - { - if (CurrentPredator is not null && !hasBeenHit) - return; + NPC.chaseable = hasBeenHit; + if (hasBeenHit) + { + float AccelerationY = Main.hardMode ? 0.4f : 0.2f; + float MaxSpeedY = Main.hardMode ? 4f : 2.5f; + float Rotation = 0; + if ((NPC.Center.Y + 0.4f) > Main.player[NPC.target].Center.Y) + { + NPC.velocity.Y -= AccelerationY; + if (NPC.velocity.Y < -MaxSpeedY) + { + NPC.velocity.Y = -MaxSpeedY; + } + } + else if ((NPC.Center.Y - 0.4f) < Main.player[NPC.target].Center.Y) + { + NPC.velocity.Y += AccelerationY; + if (NPC.velocity.Y > MaxSpeedY) + { + NPC.velocity.Y = MaxSpeedY; + } + } + float AccelerationX = Main.hardMode ? 0.4f : 0.25f; + float MaxSpeedX = Main.hardMode ? 6f : 4f; - if (shouldAttack) - { - CurrentBehavior = AttackBehavior; - AttackingEntity = player; + if (NPC.ai[0] == 1f) + { + Rotation = -0.05f; + NPC.velocity.X -= AccelerationX; + if (NPC.velocity.X < -MaxSpeedX) + { + NPC.velocity.X = -MaxSpeedX; + } + + if ((NPC.Center.X + 300f) < Main.player[NPC.target].Center.X) + { + NPC.ai[0] = 2f; + } + } + else if (NPC.ai[0] == 2f) + { + Rotation = 0.05f; + NPC.velocity.X += AccelerationX; + if (NPC.velocity.X > MaxSpeedX) + { + NPC.velocity.X = MaxSpeedX; + } + + if ((NPC.Center.X - 300f) > Main.player[NPC.target].Center.X) + { + NPC.ai[0] = 1f; + } + } + + NPC.rotation = NPC.velocity.Y * Rotation; + if (NPC.rotation < -0.1f) + { + NPC.rotation = -0.1f; + } + if (NPC.rotation > 0.1f) + { + NPC.rotation = 0.1f; + return; + } } - else if (hasBeenHit) - { - CurrentBehavior = FleeBehavior; - AvoidedEntity = player; - } - NPC.noTileCollide = shouldAttack; + else + NPC.damage = 0; } - #endregion public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter += (hasBeenHit || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 halfSizeTexture = new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[Type]); - Vector2 vector = NPC.Center - screenPos; - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0); - spriteBatch.Draw(tex, vector, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, 0, 0f); - spriteBatch.Draw(GlowTexture.Value, vector, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, 0, 0f); - - // Position where the tail starts - Vector2 tailOffset = Vector2.UnitX.RotatedBy(NPC.rotation) * (tex.Width / 2 - 4); - - if (NPC.IsABestiaryIconDummy) + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) { - for (int i = 0; i < NPC.oldRot.Length; i++) - { - NPC.oldRot[i] = 0; - } - for (int i = 0; i < NPC.oldPos.Length; i++) - { - NPC.oldPos[i] = Vector2.UnitX.RotatedBy(NPC.rotation) * ((tex.Width / 2 - 4) + i * 8); - } + spriteEffects = SpriteEffects.FlipHorizontally; } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } - float currentSegmentRotation = NPC.rotation; - List tailDrawPositions = new List(); - int segAmt = 7; - int tailLength = 40; - for (int i = 0; i < segAmt; i++) + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - float tailCompletionRatio = i / (float)segAmt; - float wrappedAngularOffset = MathHelper.WrapAngle(NPC.oldRot[i + 1] - currentSegmentRotation) * 0.6f; - float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.24f, 0.24f); - - Vector2 Offset = Vector2.UnitX.RotatedBy(NPC.rotation); - Vector2 tailSegmentOffset = Vector2.UnitX.RotatedBy(currentSegmentRotation) * tailCompletionRatio * tailLength + Offset; - tailDrawPositions.Add(NPC.Center + tailSegmentOffset + tailOffset); - - currentSegmentRotation += segmentRotationOffset; + return hasBeenHit; } - for (int i = 0; i < tailDrawPositions.Count; i++) - { - Vector2 pos = tailDrawPositions[i]; - float rot = pos.DirectionTo(NPC.Center + Vector2.UnitX.RotatedBy(NPC.rotation)).ToRotation(); - if (i > 0) - { - Vector2 oldPos = tailDrawPositions[i - 1]; - rot = pos.DirectionTo(oldPos).ToRotation(); - } - int frame = i switch - { - 1 => 10, - 5 => 20, - 6 => 32, - _ => 0 - }; - int height = 8; - if (i == 6) - height = 10; - rot += MathHelper.PiOver2; - - spriteBatch.Draw(TailTexture.Value, pos - screenPos, new Rectangle(0, frame, 10, height), NPC.GetAlpha(drawColor), rot, new Vector2(6, 4), NPC.scale, 0, 0f); - spriteBatch.Draw(TailGlowTexture.Value, pos - screenPos, new Rectangle(0, frame, 10, height), color, rot, new Vector2(6, 4), NPC.scale, 0, 0f); - } - - return false; + return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + return SpawnCondition.CaveJellyfish.Chance * 0.6f; } return 0f; } public override void HitEffect(NPC.HitInfo hit) { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } if (NPC.life <= 0) { - for (int k = 0; k < 15; k++) + for (int k = 0; k < 25; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore4").Type, 1f); + } } - CalamityUtils.SpawnGores(NPC, "EutrophicRay", 2); } } } diff --git a/NPCs/SunkenSea/EutrophicRay.png b/NPCs/SunkenSea/EutrophicRay.png index 76f3c10590..f005213289 100644 Binary files a/NPCs/SunkenSea/EutrophicRay.png and b/NPCs/SunkenSea/EutrophicRay.png differ diff --git a/NPCs/SunkenSea/EutrophicRayGlow.png b/NPCs/SunkenSea/EutrophicRayGlow.png index 805039ba34..585d222148 100644 Binary files a/NPCs/SunkenSea/EutrophicRayGlow.png and b/NPCs/SunkenSea/EutrophicRayGlow.png differ diff --git a/NPCs/SunkenSea/EutrophicRayTail.png b/NPCs/SunkenSea/EutrophicRayTail.png deleted file mode 100644 index f15d72f500..0000000000 Binary files a/NPCs/SunkenSea/EutrophicRayTail.png and /dev/null differ diff --git a/NPCs/SunkenSea/EutrophicRayTailGlow.png b/NPCs/SunkenSea/EutrophicRayTailGlow.png deleted file mode 100644 index 3c7ef2ce64..0000000000 Binary files a/NPCs/SunkenSea/EutrophicRayTailGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs deleted file mode 100644 index 68c0df7862..0000000000 --- a/NPCs/SunkenSea/FesteringRemains.cs +++ /dev/null @@ -1,188 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using System.IO; -using CalamityMod.Items.Materials; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class FesteringRemains : ModNPC - { - public List bones = new List(); - public override void SetDefaults() - { - NPC.width = 52; - NPC.height = 36; - NPC.defense = 0; - NPC.lifeMax = 200; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0f; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HauntedChum") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - // Spawn some bones around the remains - if (NPC.localAI[0] == 0) - { - int boneCount = Main.rand.Next(5, 8); - for (int i = 0; i < boneCount; i++) - { - int extraDistX = 120; - int extraDistY = 40; - Vector2 bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); - // If the bone spawns inside a tile, try to make it not spawn in a tile - for (int j = 0; j < 50; j++) - { - Tile tilePos = CalamityUtils.ParanoidTileRetrieval((int)bonePos.X / 16, (int)bonePos.Y / 16); - if (tilePos.HasTile) - { - bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); - } - } - Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool()); - GeneralParticleHandler.SpawnParticle(bone); - // Add to a list of bones - bones.Add(bone); - } - NPC.TargetClosest(); - NPC.localAI[0] = 1; - } - - // Enables expert scaling - NPC.damage = 0; - NPC.TargetClosest(); - int aggroRange = 80; - int spawnTime = 60; - Player target = Main.player[NPC.target]; - if (NPC.ai[1] == 0) - { - if (target != null && target.active && target.Distance(NPC.Center) < aggroRange) - { - NPC.ai[0]++; - if (NPC.ai[0] > spawnTime) - { - int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); - NPC.ai[1] = 1; - NPC.ai[2] = head; - SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); - Main.npc[head].localAI[0] = -MathHelper.PiOver4; - } - } - else - { - if (NPC.ai[0] > 0) - { - NPC.ai[0]--; - } - } - } - NPC spawnedHead = Main.npc[(int)NPC.ai[2]]; - // If the head has already been spawned but there is no more head (no head?) start a countdown, once the countdown reaches full, the head respawns - if (NPC.ai[1] == 1) - { - if (spawnedHead == null || !spawnedHead.active || spawnedHead.type != ModContent.NPCType()) - { - if (NPC.ai[3] == 180) - { - // Spawn the head and reset ai3 back to 0 - int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); - NPC.ai[2] = head; - NPC.ai[3] = 0; - SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); - Main.npc[head].localAI[0] = -MathHelper.PiOver4; - } - NPC.ai[3]++; - } - if (NPC.ai[0] > 0) - { - NPC.ai[0]--; - } - } - // Keep the bones alive - for (int i = 0; i < bones.Count; i++) - { - bones[i].Time = 2; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.4f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt with { Volume = 0.8f, Pitch = 1.2f }, NPC.position); - } - CalamityUtils.SpawnGores(NPC, "FesteringRemains", 1); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - // Spooky glowey aura effect - if (NPC.ai[0] > 0) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color glowColor = Color.Red; - int xOffset = NPC.spriteDirection == 1 ? 16 : 22; - spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * (NPC.ai[0] / 120), 0f, bloom.Size() / 2f, 1f, SpriteEffects.None, 0); - foreach (ChumBone bone in bones) - { - spriteBatch.Draw(bloom, bone.Position - Main.screenPosition, null, glowColor * (NPC.ai[0] / 210), 0f, bloom.Size() / 2f, 0.4f * bone.Scale, SpriteEffects.None, 0); - } - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } - return true; - } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 1, 1, 2); - } - } -} diff --git a/NPCs/SunkenSea/FesteringRemains.png b/NPCs/SunkenSea/FesteringRemains.png deleted file mode 100644 index 75b78502a4..0000000000 Binary files a/NPCs/SunkenSea/FesteringRemains.png and /dev/null differ diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 501570c573..0b69067b9f 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -1,18 +1,11 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.DataStructures; -using CalamityMod.Enums; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -22,77 +15,34 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class GhostBell : SunkenSeaNPC + public class GhostBell : ModNPC { - public static Asset PinkTexture; - public static Asset GreenTexture; + public bool hasBeenHit = false; - public static int ElectrifyingPhaseDuration => 180; - public static int ElectrifyingPhaseDischarge => 60; - public static int ElectrifyingPhaseCooldown => 120; - - public ref float Phase => ref NPC.ai[0]; - - public ref float Variant => ref NPC.ai[1]; - - public ref float Timer => ref NPC.ai[3]; - - public enum PhaseType - { - Idle = 0, - Angry = 1, - Electrifying = 2 - } - - public enum JellyColor - { - Blue = 0, - Green = 1, - Pink = 2 - } - - public List> tentacles = []; - - protected override List PreyIDs => - [ - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ]; - - protected override List PredatorIDs => []; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.PolypForest; - - public override void Load() - { - GreenTexture = ModContent.Request(Texture + "Green"); - PinkTexture = ModContent.Request(Texture + "Pink"); - } + public static Asset GlowTexture; public override void SetStaticDefaults() { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 1; + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - base.SetDefaults(); NPC.noGravity = true; NPC.aiStyle = -1; AIType = -1; - NPC.damage = 25; - NPC.width = 74; - NPC.height = 58; - NPC.defense = 0; - NPC.lifeMax = 120; + NPC.damage = Main.hardMode ? 75 : 25; + NPC.width = 54; + NPC.height = 76; + NPC.defense = Main.hardMode ? 10 : 0; + NPC.lifeMax = Main.hardMode ? 400 : 120; NPC.knockBackResist = 0f; NPC.alpha = 100; - NPC.value = Item.buyPrice(silver: 1); + NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -101,6 +51,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -114,390 +65,112 @@ namespace CalamityMod.NPCs.SunkenSea public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.chaseable); + writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.TargetClosest(); - Variant = Main.rand.Next(0, 3); - if (Phase == (int)PhaseType.Idle) - { - // 1-3 in the Polyp Forest, 3-4 in the burrows - int jellyAmt = Main.player[NPC.target].Calamity().ZonePolypForest ? Main.rand.Next(2, 4) : Main.rand.Next(3, 5); - // A swarm of babies spawns if the jelly is in the Polyp Forest - if (Main.player[NPC.target].Calamity().ZonePolypForest) - { - for (int i = 0; i < jellyAmt; i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int bebe = NPC.NewNPC(NPC.GetSource_FromThis(), (int)(NPC.Center.X + Main.rand.NextFloat(1f, 2f)), (int)(NPC.Center.Y + Main.rand.NextFloat(1f, 2f)), ModContent.NPCType(), ai0: -1); - Main.npc[bebe].rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); - } - } - } - // Spawn more adults - for (int i = 0; i < jellyAmt; i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(NPC.GetSource_FromThis(), (int)(NPC.Center.X + Main.rand.NextFloat(1f, 2f)), (int)(NPC.Center.Y + Main.rand.NextFloat(1f, 2f)), Type, ai0: -1, ai2: Main.rand.Next(0, 60)); - } - } - } + hasBeenHit = reader.ReadBoolean(); } public override void AI() { - if (pathfinding == null) + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1.5f / 255f, (255 - NPC.alpha) * 1.5f / 255f); + if (NPC.justHit) { - pathfinding = new PathfindingManager(this); - Acceleration = 0.1f; - MaxSpeed = 1f; + hasBeenHit = true; } - CreateTentacles(); - NPC.ai[2]++; - - // Lite - var lightColor = Variant switch + NPC.chaseable = hasBeenHit; + if (NPC.localAI[0] == 0f) { - (int)JellyColor.Pink => Color.LightPink, - (int)JellyColor.Green => Color.MediumSpringGreen, - _ => Color.LightBlue, - }; - Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); - - NPC.chaseable = Phase > 0; - NPC.noGravity = NPC.wet; - - NPC.netUpdate = true; - NPC.netSpam = 0; - - Entity target = CurrentPrey; - if (NPC.target > -1 && (int)Phase >= (int)PhaseType.Angry) - { - target = Main.player[NPC.target]; - } - - // Ghost Bells are usually in groups, so make them not overlap - float SAImovement = 0.05f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || otherFish.type != ModContent.NPCType()) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width * 2f) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - - if (Phase <= (int)PhaseType.Idle) - { - NPC.velocity *= 0.8f; - } - - if (target == null || !target.active || target.Distance(NPC.Center) > 1000) - { - Timer = 0; - Phase = (int)PhaseType.Idle; - NPC.netUpdate = true; - return; - } - - // Create an electrifying aura - if (Phase == (int)PhaseType.Electrifying) - { - // Slow down - NPC.velocity *= 0.9f; - pathfinding.ClearResults(); - Timer++; - // Create the aura - if (NPC.ai[3] == 1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 12, 0, ai1: NPC.whoAmI + 1); - } - } - // Reset - if (Timer >= ElectrifyingPhaseDuration) - { - Timer = -ElectrifyingPhaseCooldown; - Phase = (int)PhaseType.Angry; - NPC.netUpdate = true; - } - } - // Move towards target - else if (target != null) - { - pathfinding.DoPathfinding(new PathfindingParameters(this, NPC.Center, target.Center, SunkenSeaTileValiditySizeless)); - if (pathfinding.Path.Count > 0) - if (pathfinding.Path[^1].Distance(target.Center) > 300) - { - pathfinding.ClearResults(); - } - if (Phase == (int)PhaseType.Angry) - { - if (target is Player && NPC.Distance(target.Center) < 300) - { - Timer++; - } - if (Timer > 120) - { - Timer = 0; - Phase = (int)PhaseType.Electrifying; - NPC.netUpdate = true; - } - } - } - } - - public void CreateTentacles() - { - if (tentacles == null || tentacles.Count < 6) - { - // switches between tentacle indexes to determine how many segments should be on each - // aims for a more squid-like distribution, i dont know if it applies to jellyfish too - - // an embarrassing amount of time was spent figuring out these numbers - // i forgot they start at 0.. - int segmentCount = tentacles.Count switch - { - 0 or 5 => 9, - 1 or 4 => 12, - _ => 8 - }; - List segments = new List(segmentCount); - for (int i = 0; i < segmentCount; i++) - { - VerletSimulatedSegment segment = new VerletSimulatedSegment(NPC.Center - Vector2.UnitY * i * 5); - segments.Add(segment); - } - segments[0].locked = true; - tentacles.Add(segments); - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - GetPissed(player.whoAmI); - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - if (projectile.friendly && projectile.owner > -1) - { - GetPissed(projectile.owner); - } - } - - public void GetPissed(int player) - { - if (Phase <= (int)PhaseType.Idle) - { - Phase = (int)PhaseType.Angry; + NPC.localAI[0] = 1f; + NPC.velocity.Y = -6f; NPC.netUpdate = true; } - NPC.target = player; - - foreach (NPC n in Main.ActiveNPCs) + if (NPC.wet) { - if (n.type != Type) - continue; - if (n.Distance(NPC.Center) > 400) - continue; - if (n.ModNPC().Phase <= (int)PhaseType.Idle) - n.ModNPC().GetPissed(player); + NPC.noGravity = true; + if (NPC.localAI[2] > 0f) + { + NPC.localAI[2] -= 1f; + } + if (NPC.localAI[2] <= 0f) + { + if (NPC.velocity.Y == 0f) + { + NPC.localAI[1] += 1f; + } + else + { + NPC.localAI[1] = 0f; + } + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 3f || NPC.localAI[1] >= 6f) + { + NPC.velocity.Y = -3f; + } + } } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + else { - if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.5f; - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - + NPC.noGravity = false; + NPC.velocity.Y = 2f; + NPC.localAI[2] = 75f; + NPC.netUpdate = true; } - return 0f; } public override void FindFrame(int frameHeight) { - // For bestiary animation - if (NPC.IsABestiaryIconDummy) - { - NPC.ai[2]++; - } + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override float SpawnChance(NPCSpawnInfo spawnInfo) { - // Underlying tentacle colour based on parent colour - Color baseCol = Variant switch - { // all of these colours are from the sprites but slightly darkened and desaturated - (int)JellyColor.Green => new Color(29, 54, 39), // 27, 61, 40 - (int)JellyColor.Pink => new Color(79, 39, 53), // 97, 38, 60 - _ => new Color(34, 50, 89) // 36, 55, 114 - }; - // Accent color is also based on parent color - Color col = Variant switch - { // these are also directly from the sprites, with no modifications; similar in luminance for visual consistency - (int)JellyColor.Green => new Color(59, 215, 194), - (int)JellyColor.Pink => new Color(255, 145, 238), - _ => new Color(84, 215, 254) - }; - - Vector2 drawOffset = Vector2.Zero; // An added offset that gives the jellyfish a visual bobbing movement - - int fullTime = 180; // How long the bob animation lasts - int localTimer = (int)(NPC.ai[2] % fullTime); - float goUp = (int)(fullTime * 0.4f); // When should the jellyfish jet upwards - int height = 30; // The vertical range the jellyfish moves - - int endElectricity = 60; - - Vector2 squash = new Vector2(1.1f, 0.9f); - Vector2 stretch = new Vector2(0.8f, 1.2f); - Vector2 finalScale; - - // Move up and down while squashing and stretching - if (localTimer < goUp) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - drawOffset.Y += MathHelper.Lerp(height, 0, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, goUp - 1, localTimer, true), 1)); - finalScale = Vector2.Lerp(stretch, squash, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, goUp - 1, localTimer, true), 1)); + return SpawnCondition.CaveJellyfish.Chance * 0.9f; } - else + return 0f; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) { - drawOffset.Y += MathHelper.Lerp(0, height, CalamityUtils.SineInEasing(Utils.GetLerpValue(goUp, fullTime - 1, localTimer, true), 1)); - finalScale = Vector2.Lerp(squash, stretch, CalamityUtils.SineInEasing(Utils.GetLerpValue(goUp, fullTime - 1, localTimer, true), 1)); + spriteEffects = SpriteEffects.FlipHorizontally; } - // Use different squash n stretch when electrifying - if (Phase == (int)PhaseType.Electrifying) - { - squash = new Vector2(1.4f, 0.8f); - if (Timer < (ElectrifyingPhaseDuration - 80)) - finalScale = Vector2.Lerp(Vector2.One, squash, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, ElectrifyingPhaseDischarge, Timer, true), 1)); - else - finalScale = Vector2.Lerp(squash, Vector2.One, CalamityUtils.SineInEasing(Utils.GetLerpValue(endElectricity, ElectrifyingPhaseDuration, Timer, true), 1)); - } - // Keeps the hitbox centered - drawOffset.Y -= height / 2; + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } - if (NPC.IsABestiaryIconDummy) - { - drawOffset.Y -= 20; - } + // Can only hit the target if they're touching the tentacles + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Vector2 npcCenter = NPC.Center; + Rectangle tentacleHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)npcCenter.Y, NPC.width / 2, NPC.height / 2); - CreateTentacles(); + Rectangle targetHitbox = target.Hitbox; + bool insideTentacleHitbox = targetHitbox.Intersects(tentacleHitbox); - // Update the chains - for (int i = 0; i < tentacles.Count; i++) - { - List segments = tentacles[i]; - - segments[0].oldPosition = segments[0].position; - segments[0].position = NPC.Center + new Vector2(MathHelper.Lerp(-20, 20, (i + 1) / (float)tentacles.Count), 10) + drawOffset; - - // While electrifying, flail tentacles around frantically - if (Phase == (int)PhaseType.Electrifying && Timer % 5 == 0 && Timer < endElectricity) - { - for (int j = 0; j < segments.Count; j++) - { - int randomness = (int)MathHelper.Lerp(6, 18, (1 + j) / segments.Count); - segments[j].oldPosition = segments[j].position; - segments[j].position += Main.rand.NextVector2Circular(randomness, randomness); - } - } - tentacles[i] = VerletSimulatedSegment.SimpleSimulation(segments, 5, loops: 1, gravity: 0.6f); - } - - // Draw tentacle chains - for (int t = 0; t < tentacles.Count; t++) - { - List segments = tentacles[t]; - for (int i = 0; i < segments.Count - 1; i++) - { - VerletSimulatedSegment seg = segments[i]; - float dist = i > 0 ? Vector2.Distance(seg.position, segments[i - 1].position) : 0; - if (dist <= 2) - dist = 2; - dist += 4; - if (i == segments.Count - 1) - { - dist = Vector2.Distance(seg.position, NPC.Center) + 2; - } - float rot = 0f; - if (i > 0) - rot = seg.position.DirectionTo(segments[i - 1].position).ToRotation(); - - // slight gradient to a lighter colour the higher the segment index - Color finalColor = baseCol; - finalColor *= 1 + (i * 0.15f); - - // Last few segments are way brighter - if (i > segments.Count - 3) - { - finalColor = col * (0.05f + segments.Count * 0.1f); - } - - // Color eases in and out while angry - if (Phase == (int)PhaseType.Angry || NPC.IsABestiaryIconDummy) - { - float mod = NPC.ai[2] % 30; - if (mod <= 10) - finalColor = Color.Lerp(finalColor, finalColor * 2, Utils.GetLerpValue(0, 10, mod, true)); - else if (mod >= 20) - finalColor = Color.Lerp(finalColor * 2, finalColor, Utils.GetLerpValue(20, 30, mod, true)); - else - finalColor *= 2; - } - // Color is at full brightness while electrifying - else if (Phase == (int)PhaseType.Electrifying) - finalColor *= 2; - // give the segments variable width (and an offset equal to half of the variance) to create more visual interest - // a side effect of this makes it look wiggly like some jellyfish tentacles are - SpriteEffects dir = NPC.Center.X > NPC.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; - spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2(seg.position.X - i * 0.1f, seg.position.Y) - screenPos, new Rectangle(0, 0, (int)(3 + i * 0.2), 8), finalColor, rot + MathHelper.PiOver2, new Vector2(4, 4), new Vector2(1, dist / 8), dir, 0); - } - } - - Texture2D tex = Variant switch - { - (int)JellyColor.Pink => PinkTexture.Value, - (int)JellyColor.Green => GreenTexture.Value, - _ => TextureAssets.Npc[Type].Value - }; - - Main.EntitySpriteDraw(tex, NPC.Center - screenPos + drawOffset, null, Color.White, NPC.rotation, tex.Size() / 2, finalScale * NPC.scale, 0); - return false; + return insideTentacleHitbox; } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Electrified, 120, true); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SunkenSea/GhostBell.png b/NPCs/SunkenSea/GhostBell.png index 8af8c6e258..0a9a975802 100644 Binary files a/NPCs/SunkenSea/GhostBell.png and b/NPCs/SunkenSea/GhostBell.png differ diff --git a/NPCs/SunkenSea/GhostBellGlow.png b/NPCs/SunkenSea/GhostBellGlow.png new file mode 100644 index 0000000000..0a9a975802 Binary files /dev/null and b/NPCs/SunkenSea/GhostBellGlow.png differ diff --git a/NPCs/SunkenSea/GhostBellGreen.png b/NPCs/SunkenSea/GhostBellGreen.png deleted file mode 100644 index 025fed69f0..0000000000 Binary files a/NPCs/SunkenSea/GhostBellGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/GhostBellPink.png b/NPCs/SunkenSea/GhostBellPink.png deleted file mode 100644 index 063a71e0d1..0000000000 Binary files a/NPCs/SunkenSea/GhostBellPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index d22a59ec8c..1578efa56c 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -559,6 +559,7 @@ namespace CalamityMod.NPCs.SunkenSea // Equipment npcLoot.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 3); // Trophy npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/SunkenSea/GildedAxolotl.cs b/NPCs/SunkenSea/GildedAxolotl.cs deleted file mode 100644 index 1808f03f64..0000000000 --- a/NPCs/SunkenSea/GildedAxolotl.cs +++ /dev/null @@ -1,589 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.BiomeManagers; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Dusts; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class GildedAxolotl : SunkenSeaNPC - { - private enum AnimationState { Water, Land } - private AnimationState Animation - { - get => (AnimationState)NPC.ai[1]; - set - { - if (value != Animation) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - NPC.ai[1] = (float)value; - } - } - - private enum PhaseType { Idle = 0, Flee = 1, Hunt = 2 } - public ref float CurrentBehavior => ref NPC.ai[0]; - public ref float GroundMovementTimer => ref NPC.ai[2]; - - public Vector2 targetPoint; - - public int IdleMinPathDistance = 400; - public int IdleMaxPathDistance = 1800; - public float FleeMaxSpeed = 8; - public float HuntMaxSpeed = 6; - public float IdleMaxSpeed = 3.2f; - - // Delays for effects triggering again after being executed - private int FleeFXCooldown = 300; - public int FleeTimer = 0; - private int PassiveSoundCooldown = 240; - public int PassiveSoundTimer = 0; - private int NoticeHeldItemSoundCooldown = 180; - public int NoticeHeldItemSoundTimer = 0; - - public bool PathfindToPlayer = false; - - public float auraFade = 0; - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - - public static readonly SoundStyle noticedBaitSound = new("CalamityMod/Sounds/Custom/GildedAxolotlNeuronActivation"); - public static readonly SoundStyle ambientNoise = new("CalamityMod/Sounds/Custom/GildedAxolotlVocalStim", 2); - public static readonly SoundStyle alert = new("CalamityMod/Sounds/Custom/GildedAxolotlAlert"); - - #region SunkenSea Fields - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - protected override List PreyIDs => new() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override List PredatorIDs => new() - { - ModContent.NPCType(), - ModContent.NPCType(), - // ModContent.NPCType(), - // ModContent.NPCType() - }; - - #endregion - - protected List ItemsOfInterest => new() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 7; - NPCID.Sets.CountsAsCritter[Type] = true; - Main.npcCatchable[Type] = true; - } - - public override void SetDefaults() - { - base.SetDefaults(); - - NPC.aiStyle = -1; - NPC.width = 84; - NPC.height = 42; - - NPC.damage = 7; - NPC.defense = 7; - NPC.lifeMax = 77; - NPC.knockBackResist = 0f; - NPC.lavaImmune = true; - NPC.noGravity = true; - NPC.noTileCollide = false; - NPC.GravityIgnoresLiquid = true; - NPC.chaseable = false; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath9; - - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - - NPC.catchItem = ModContent.ItemType(); - - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = false; - NPC.Calamity().VulnerableToWater = false; - NPC.Calamity().VulnerableToCold = true; - - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - #region Syncing - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.ai[0] = reader.ReadSingle(); // CurrentBehavior - NPC.ai[1] = reader.ReadSingle(); // Anim state - NPC.ai[2] = reader.ReadSingle(); // Ground movement timer - targetPoint = reader.ReadVector2(); // For pathfinding points - auraFade = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.ai[0]); // CurrentBehavior - writer.Write(NPC.ai[1]); // Anim state - writer.Write(NPC.ai[2]); // Ground movement timer - writer.WriteVector2(targetPoint); // For pathfinding points - writer.Write(auraFade); - } - - #endregion - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GildedAxolotl") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.4f; - MaxSpeed = IdleMaxSpeed; - MinimumPointDistance = 60f; - } - - // Find nearby players - NPC.TargetClosest(false); - Player nearestPlayer = null; - float nearestPlayerDistance = 10000f; - - float detectionRange = 700f; - float buffRange = 290f; - - Player nearestPlayerForVisuals = null; - float nearestPlayerDistanceForVisuals = 10000f; - - // Handle aura buff for any nearby player - for (int i = 0; i < Main.maxPlayers; i++) - { - Player p = Main.player[i]; - if (!p.active || p.dead) - continue; - - float distance = Vector2.Distance(NPC.Center, p.Center); - - if (distance < buffRange && distance < nearestPlayerDistanceForVisuals) - { - nearestPlayerForVisuals = p; - nearestPlayerDistanceForVisuals = distance; - } - - if (distance < buffRange) - { - p.AddBuff(ModContent.BuffType(), 60, true); - } - - // Track the nearest player holding a target item - if (distance < detectionRange && ItemsOfInterest.Contains(p.HeldItem.type)) - { - if (distance < nearestPlayerDistance) - { - nearestPlayer = p; - nearestPlayerDistance = distance; - } - } - } - - // Handle aura vfx - float distanceForVisual = nearestPlayerForVisuals != null ? nearestPlayerDistanceForVisuals : buffRange; - float maxDistance = buffRange * 1.5f; - float minDistance = 120f; - auraFade = Utils.GetLerpValue(maxDistance, minDistance, distanceForVisual, clamped: true); - - // Allow NPCs to be buffed while in the aura, including this npc. - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC targetNPC = Main.npc[i]; - if (!targetNPC.active) - continue; - - float distance = Vector2.Distance(NPC.Center, targetNPC.Center); - - if (distance < buffRange) - { - targetNPC.AddBuff(ModContent.BuffType(), 60, true); - } - } - - // Handle dust which dynamically changes alpha based on distance and time - if (auraFade > 0f) - { - float pulse = 0.6f + 0.25f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2.5f); - int baseAlpha = (int)(255f * (1f - auraFade * 0.5f * pulse)); - if (baseAlpha < 0) baseAlpha = 0; - if (baseAlpha > 255) baseAlpha = 255; - - - int innerDustCount = Main.rand.Next(0, 2); - - for (int i = 0; i < innerDustCount; i++) - { - float areaSize = 255f; - Vector2 spawnSpot = NPC.Center + Main.rand.NextVector2Circular(areaSize, areaSize); - - Dust dust = Dust.NewDustPerfect(spawnSpot, ModContent.DustType()); - dust.scale = Main.rand.NextFloat(0.6f, 1.1f); - dust.noGravity = true; - dust.alpha = baseAlpha; - dust.color = (Main.rand.NextBool(2) ? Color.Silver : Color.Gold) * 2f; - dust.noLight = true; - dust.noLightEmittence = true; - dust.velocity *= 0.05f; - } - } - - // When detecting a player holding of one of the Axolotl's prey - if (nearestPlayer != null) - { - if (CurrentBehavior == (float)PhaseType.Idle) - { - if (NoticeHeldItemSoundTimer <= 0) - { - SoundEngine.PlaySound(noticedBaitSound with { Volume = 0.7f, Pitch = 0.1f, PitchVariance = 0.1f }, NPC.Center); - NoticeHeldItemSoundTimer = NoticeHeldItemSoundCooldown; - } - - CurrentBehavior = (float)PhaseType.Hunt; - PathfindToPlayer = true; - NPC.netUpdate = true; - pathfinding.ClearResults(); - } - } - - else - { - if (CurrentBehavior == (float)PhaseType.Hunt && PathfindToPlayer) - CurrentBehavior = CurrentPrey != null ? (float)PhaseType.Hunt : (float)PhaseType.Idle; - - PathfindToPlayer = false; - } - - Lighting.AddLight(NPC.Center, Color.Gold.ToVector3() * (auraFade * 0.8f)); // Passively emit light based on auraFade - - if (NPC.wet) - { - NPC.noGravity = true; - Animation = AnimationState.Water; - - switch ((PhaseType)CurrentBehavior) - { - case PhaseType.Idle: - IdleBehavior(); - break; - case PhaseType.Flee: - FleeBehavior(); - break; - case PhaseType.Hunt: - HuntBehavior(); - break; - } - - if (NPC.velocity != Vector2.Zero) - { - int dir = NPC.velocity.X.DirectionalSign(); - if (dir != 0) - NPC.spriteDirection = NPC.direction = dir; - - float targetRotation = NPC.velocity.ToRotation(); - if (NPC.spriteDirection == -1) - targetRotation = MathHelper.WrapAngle(targetRotation - MathHelper.Pi); - - NPC.rotation = MathHelper.Clamp(targetRotation, -MathHelper.PiOver2, MathHelper.PiOver2); - } - else - NPC.rotation = 0f; - } - - else // Refer to BeachedBehavior for grounded movement - { - Animation = AnimationState.Land; - BeachedBehavior(); - pathfinding.ClearResults(); - } - - // Timers - if (FleeTimer > 0) - FleeTimer--; - if (PassiveSoundTimer > 0) - PassiveSoundTimer--; - if (NoticeHeldItemSoundTimer > 0) - NoticeHeldItemSoundTimer--; - } - - public void IdleBehavior() - { - MaxSpeed = IdleMaxSpeed; - - // Always pathfind to a random point when idling -            pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - - if (Main.rand.NextBool(300) && PassiveSoundTimer <= 0) // Randomly emit a noise - { - SoundEngine.PlaySound(ambientNoise with { Volume = 0.66f, Pitch = 0.1f, PitchVariance = 0.15f }, NPC.Center); - PassiveSoundTimer = PassiveSoundCooldown; - } - } - - public void HuntBehavior() - { - MaxSpeed = HuntMaxSpeed; - - if (PathfindToPlayer) // Player is holding an item of interest -            { - Player target = Main.player[NPC.target]; - targetPoint = target.Center; - } - else - { -                // If prey is gone, go back to idling -                if (CurrentPrey == null) - { - CurrentBehavior = (float)PhaseType.Idle; - return; - } - targetPoint = CurrentPrey.Center; - } - - pathfinding.DoPathfinding(new(this, NPC.Center, targetPoint, tileValidity: SunkenSeaTileValidity)); - } - - public void FleeBehavior() - { - if (CurrentPredator == null) - { - CurrentBehavior = CurrentPrey != null ? (float)PhaseType.Hunt : (float)PhaseType.Idle; - FleeTimer = 0; - return; - } - - if (FleeTimer <= 0) // Specifically for VFX and SFX when fleeing - { - SoundEngine.PlaySound(alert with { Volume = 0.9f, PitchVariance = 0.1f }, NPC.Center); - - if (!Main.dedServ) - { - var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); - GeneralParticleHandler.SpawnParticle(new EmoteExpressionParticle(NPC.Center + emoteDirection * 2f, emoteDirection, 2.2f, Color.Yellow, Main.rand.Next(30, 46), EmoteExpressionParticle.EmoteType.Exclamation)); - } - - FleeTimer = FleeFXCooldown; - } - - MaxSpeed = FleeMaxSpeed; - - // Try to find a safe point from predator - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - Vector2 runDirection = NPC.DirectionFrom(CurrentPredator.Center); - targetPoint = NPC.Center + runDirection * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - - pathfinding.DoPathfinding(new(this, NPC.Center, targetPoint, SunkenSeaTileValidity)); - NPC.netUpdate = true; - } - - public void BeachedBehavior() - { - NPC.noGravity = false; // Gravity on while not swimming - if (NPC.collideY) - { - if (GroundMovementTimer <= 0) - { - NPC.velocity.X *= 0.94f; // Slow down -                    if (Math.Abs(NPC.velocity.X) < 0.2f) - NPC.velocity.X = 0f; - - if (Main.rand.NextBool(80)) - { - if (Main.rand.NextBool()) - NPC.direction = -1; - else - NPC.direction = 1; - - NPC.spriteDirection = NPC.direction; - GroundMovementTimer = Main.rand.Next(30, 70); - NPC.velocity.X = 1.2f * NPC.direction; - NPC.netUpdate = true; - } - } - - else - GroundMovementTimer--; - } - - if (Math.Abs(NPC.velocity.X) > 0.01f) // Face chosen direction while moving - { - int dir = NPC.velocity.X.DirectionalSign(); - if (dir != 0) - NPC.spriteDirection = NPC.direction = dir; - } - - if (Main.rand.NextBool(300) && PassiveSoundTimer <= 0) // Randomly emit a noise - { - SoundEngine.PlaySound(ambientNoise with { Volume = 0.66f, Pitch = 0.1f, PitchVariance = 0.15f }, NPC.Center); - PassiveSoundTimer = PassiveSoundCooldown; - } - - NPC.rotation = 0f; // Rotation not needed when not in water - } - - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = (float)PhaseType.Flee; // Hit the bricks regardless of what the current action is - NPC.netUpdate = true; - } - - protected override void OnPreyDetection(NPC prey) - { - // Only start hunting if not fleeing from a pred - if ((PhaseType)CurrentBehavior != PhaseType.Flee) - { - CurrentBehavior = (float)PhaseType.Hunt; - NPC.netUpdate = true; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - int frameGate; - - if (Animation == AnimationState.Water) - { - frameGate = (NPC.velocity.Length() > 3.5f ? 5 : 7); // Flap limbs faster when going fast - } - - else // Land - { - if (Math.Abs(NPC.velocity.X) > 0.1f) - { - frameGate = 6; - } - else - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - return; - } - } - - if (NPC.frameCounter > frameGate) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; // Loop anim - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.1777f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 7; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCoin, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "GildedAxolotl", 3); - } - - public override void OnKill() - { - for (int k = 0; k < 7; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), Main.rand.NextFloat(0, MathHelper.TwoPi), Main.rand.NextFloat(-1f, 3f), 0, default, 1f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - - // Draw aura circle behind the axolotl - float auraOpacity = auraFade * 0.4f; - if (auraOpacity > 0f) - { - Texture2D auraTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Main.EntitySpriteDraw(auraTexture, NPC.Center - screenPos, null, (Color.Gold * auraOpacity) with { A = 0 }, NPC.rotation, auraTexture.Size() * 0.5f, 7.77f, SpriteEffects.None, 0); - } - - // Main NPC drawing - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 origin = new Vector2(tex.Width / 4, tex.Height / (Main.npcFrameCount[Type] * 2)); - - float yOffset = Animation == AnimationState.Land ? 2f : 0f; // Draws 2 pixels down out of water. The way it's sheeted makes it best to handle it this way as to not edit the hitbox. - Vector2 drawPos = NPC.Center - screenPos + Vector2.UnitY * (NPC.gfxOffY + yOffset); - - Rectangle frame = tex.Frame(2, Main.npcFrameCount[Type], (int)Animation, NPC.frame.Y / NPC.height); - - // Draw backglow that scales with auraFade - if (auraFade > 0f) - { - float glowScale = NPC.scale * (1f + (0.0777f * auraFade)); - float pulse = 0.8f + 0.15f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f); - Color glowColor = (Color.Gold * auraFade * pulse) with { A = 0 }; - - spriteBatch.Draw(tex, drawPos, frame, glowColor, NPC.rotation, origin, glowScale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - } - - spriteBatch.Draw(tex, drawPos, frame, NPC.GetAlpha(drawColor * (1f + auraFade * 3)), NPC.rotation, origin, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/GildedAxolotl.png b/NPCs/SunkenSea/GildedAxolotl.png deleted file mode 100644 index e9c69adfb6..0000000000 Binary files a/NPCs/SunkenSea/GildedAxolotl.png and /dev/null differ diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs deleted file mode 100644 index 28b16dbe2c..0000000000 --- a/NPCs/SunkenSea/HauntedChum.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.BiomeManagers; -using CalamityMod.DataStructures; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class HauntedChum : ModNPC - { - public static Asset jawTexture; - public List Segments; - - public override void Load() - { - jawTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/HauntedChumMouth"); - } - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - public override void SetDefaults() - { - NPC.width = 36; - NPC.height = 50; - NPC.defense = 5; - NPC.lifeMax = 60; - NPC.damage = 20; - NPC.aiStyle = -1; - NPC.alpha = 255; - AIType = -1; - NPC.HitSound = SoundID.DD2_SkeletonHurt; - NPC.DeathSound = SoundID.DD2_SkeletonDeath; - NPC.noGravity = true; - NPC.noTileCollide = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void AI() - { - int aggroRange = 600; - if (NPC.direction == 0) - { - NPC.TargetClosest(); - } - Player target = Main.player[NPC.target]; - NPC body = Main.npc[(int)NPC.ai[3]]; - // Create a chain - if (Segments == null || Segments.Count < 10) - { - Segments = new List(10); - for (int i = 0; i < 10; i++) - { - VerletSimulatedSegment segment = new VerletSimulatedSegment(body.Center + Vector2.UnitY * i * 10); - Segments.Add(segment); - } - - Segments[0].locked = true; - Segments[Segments.Count - 1].locked = true; - } - if (body == null || !body.active || body.type != ModContent.NPCType()) - { - NPC.StrikeInstantKill(); - } - switch (NPC.ai[0]) - { - case 0: - NPC.velocity.Y = -1; - NPC.ai[1]++; - if (NPC.alpha > 0) - { - NPC.alpha -= 25; - } - if (NPC.ai[1] > 30) - { - NPC.ai[0] = 1; - NPC.ai[1] = 0; - } - break; - case 1: - if (target != null && target.active && target.Distance(body.Center) < aggroRange) - { - NPC.ai[0] = 2; - NPC.ai[1] = 0; - NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.Zombie7, NPC.Center); - } - NPC.TargetClosest(); - NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.05f); - if (NPC.velocity.Length() < 0.25f) - { - if (NPC.Distance(body.Center) > 320) - { - Vector2 direction = NPC.DirectionTo(body.Center); - direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 4; - } - else - { - Vector2 direction = Main.rand.NextVector2Circular(30, 30); - direction = direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 4; - } - } - // Lose brightness - if (NPC.ai[1] < 30) - { - NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.01f, 0); - } - NPC.velocity *= 0.98f; - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - break; - case 2: - if (target == null || !target.active || target.Distance(body.Center) >= aggroRange) - { - NPC.ai[0] = 1; - NPC.ai[1] = 0; - } - else - { - NPC.ai[1]++; - float dist = target.Distance(NPC.Center); - if (dist < 32 || NPC.ai[1] > 50) - { - NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.3f); - } - else - { - NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], 0, 0.1f); - } - // Lose brightness - if (NPC.ai[1] < 30) - { - NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.02f, 0); - } - // Gain brightness - else if (NPC.ai[1] > 60) - { - NPC.localAI[1] = MathHelper.Min(NPC.localAI[1] + 0.06f, 0.6f); - } - if (NPC.ai[1] > 70) - { - NPC.TargetClosest(); - Vector2 direction = NPC.DirectionTo(target.Center); - direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 7; - SoundEngine.PlaySound(SoundID.DD2_PhantomPhoenixShot with { Pitch = 0.8f, Volume = 0.8f }, NPC.Center); - NPC.ai[1] = 0; - } - else - { - NPC.velocity.X *= 0.99f; - NPC.velocity.Y *= 0.999f; - } - } - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - break; - } - NPC.spriteDirection = NPC.direction; - if (NPC.localAI[1] > 0) - { - Lighting.AddLight(NPC.Center, 1 * NPC.localAI[1], 0, 0); - } - for (int i = 0; i < 2; i++) - { - int dustPos = NPC.spriteDirection == 1 ? -10 : 0; - if (ChildSafety.Disabled) - { - Dust.NewDust(new Vector2(NPC.Center.X + dustPos, NPC.position.Y + NPC.height / 4), 0, NPC.height / 2, DustID.Blood, -NPC.spriteDirection * Main.rand.NextFloat(4f, 5f), Main.rand.NextFloat(-3, 3), Scale: Main.rand.NextFloat(0.6f, 1f)); - } - } - - // Update the chain - Segments[0].oldPosition = Segments[0].position; - Segments[0].position = body.Center + new Vector2(body.spriteDirection * 20, 8); - - Segments[Segments.Count - 1].oldPosition = Segments[Segments.Count - 1].position; - Segments[Segments.Count - 1].position = body.active ? NPC.Center : body.Center; - - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 10, loops: 1, gravity: 0.3f); - - NPC.ForceNetUpdate(); - } - - internal float WidthFunction(float completionRatio, Vector2 vertexPos) - { - return MathHelper.Clamp(((float)Math.Cos(completionRatio * 60)) + 2, 1, 2) / 2; - } - - internal Color ColorFunction(float completionRatio, Vector2 vertexPos) - { - return (int)(completionRatio * 100) % 2 == 0 ? new Color(69, 52, 0) : new Color(); - } - - internal float BackgroundWidthFunction(float completionRatio, Vector2 vertexPos) => WidthFunction(completionRatio, vertexPos) * 3f; - - internal Color BackgroundColorFunction(float completionRatio, Vector2 vertexPos) - { - return Color.Black; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sandnado, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - // Drop a bone gore for each bone - if (Segments != null && Segments.Count > 0) - { - for (int i = 0; i < Segments.Count; i++) - { - VerletSimulatedSegment v = Segments[i]; - int goreType = i < Segments.Count / 2 ? Mod.Find("ChumBone2").Type : Mod.Find("ChumBone1").Type; - if (!Main.dedServ) - { - Gore.NewGorePerfect(NPC.GetSource_Death(), v.position, new Vector2(Main.rand.NextFloat(-2, 2), -6), goreType); - } - } - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChum").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChumMouth").Type, 1f); - } - } - } - - public override bool CheckActive() - { - return !(Main.npc[(int)NPC.ai[3]].active && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - List points = new List(); - if (Segments != null && Segments.Count > 0) - { - for (int i = 0; i < Segments.Count; i++) - { - points.Add(Segments[i].position); - } - } - - PrimitiveRenderer.RenderTrail(points, new(BackgroundWidthFunction, BackgroundColorFunction), 75); - PrimitiveRenderer.RenderTrail(points, new(WidthFunction, ColorFunction), 75); - - NPC body = Main.npc[(int)NPC.ai[3]]; - // Draw a chain of bones - if (body != null && body.active && body.type == ModContent.NPCType()) - { - if (Segments == null || Segments.Count <= 0) - { - return true; - } - for (int i = 0; i < Segments.Count - 1; i++) - { - VerletSimulatedSegment seg = Segments[i]; - float dist = i > 0 ? Vector2.Distance(seg.position, Segments[i - 1].position) : 0; - if (dist <= 2) - dist = 2; - dist += 2; - if (i == Segments.Count - 1) - { - dist = Vector2.Distance(seg.position, body.Center) + 2; - } - float rot = 0f; - if (i > 0) - rot = seg.position.DirectionTo(Segments[i - 1].position).ToRotation(); - SpriteEffects dir = NPC.Center.X > body.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; - Texture2D bone = i < Segments.Count / 2 ? ModContent.Request(ChumBone.Texture2).Value : ModContent.Request("CalamityMod/Particles/ChumBone1").Value; - spriteBatch.Draw(bone, seg.position - Main.screenPosition, null, Lighting.GetColor((int)(seg.position.X / 16), (int)(seg.position.Y / 16)) * NPC.Opacity, rot, bone.Size() / 2, 1f, dir, 0); - } - } - - // Spooky glowey aura effect - if (NPC.ai[0] == 2 && NPC.ai[1] < 50) - { - spriteBatch.EnterShaderRegion(BlendState.Additive); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Color glowColor = Color.Red; - int xOffset = NPC.spriteDirection == 1 ? 16 : 22; - spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * NPC.localAI[1], 0f, bloom.Size() / 2f, 0.8f, SpriteEffects.None, 0); - spriteBatch.ExitShaderRegion(); - } - - // Draw the chum itself and its jaw, rotated by localai[0] - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); - Vector2 jawOrigin = new Vector2(NPC.spriteDirection == 1 ? jawTexture.Value.Width - 22 : 22, 4); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(jawTexture.Value, npcOffset + new Vector2(16 * -NPC.spriteDirection, 4), null, NPC.GetAlpha(drawColor), NPC.localAI[0] * NPC.spriteDirection, jawOrigin, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(texture, npcOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/HauntedChum.png b/NPCs/SunkenSea/HauntedChum.png deleted file mode 100644 index 11b9e1f220..0000000000 Binary files a/NPCs/SunkenSea/HauntedChum.png and /dev/null differ diff --git a/NPCs/SunkenSea/HauntedChumMouth.png b/NPCs/SunkenSea/HauntedChumMouth.png deleted file mode 100644 index 6fa25c049e..0000000000 Binary files a/NPCs/SunkenSea/HauntedChumMouth.png and /dev/null differ diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs deleted file mode 100644 index e1912c55a2..0000000000 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ /dev/null @@ -1,327 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.BiomeManagers; -using CalamityMod.DataStructures; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Jellyghoul : ModNPC - { - public static Color lesserRed = new Color(255, 100, 100); - public static Color startColor = new Color(111, 115, 122); - public static Color endColor = new Color(87, 103, 113); - - // Cycle between two gray colors by default - public Color DefaultColor => Color.Lerp(startColor, endColor, NPC.localAI[1] * 0.25f + MathF.Sin(Main.GlobalTimeWrappedHourly)); - - // Turn red when enraged, otherwise just continue using DefaultColor - public Color FinalColor => NPC.ai[2] > 0 ? Color.Lerp(DefaultColor, lesserRed, NPC.ai[2]) : DefaultColor; - - - public static SoundStyle JellyGhoulScream = SoundID.NPCDeath51 with { Pitch = -1, Volume = 0.2f, MaxInstances = 0 }; - - public static Asset tentacleTexture; - - public override void Load() - { - tentacleTexture = ModContent.Request(Texture + "Tentacle"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 1; - } - - public override void SetDefaults() - { - NPC.npcSlots = 1f; - NPC.noGravity = true; - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 0; - NPC.width = 28; - NPC.height = 36; - NPC.defense = 0; - NPC.lifeMax = 1; - NPC.knockBackResist = 0f; - NPC.alpha = 100; - NPC.HitSound = null; // instantly dies - NPC.DeathSound = SoundID.NPCDeath3; - NPC.chaseable = false; - NPC.noTileCollide = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Jellyghoul") - }); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.position -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); - } - public override void AI() - { - // LocalAI controls variance between jellies. Randomize it on spawn to desync them - if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] = 1f; - NPC.localAI[1] = Main.rand.NextFloat(0, 4f); - NPC.netUpdate = true; - } - - Lighting.AddLight(NPC.Center, FinalColor.R * 0.002f, FinalColor.G * 0.002f, FinalColor.B * 0.002f); - - NPC.ai[0]++; - // Play a scream randomly with a 5 second cooldown - // Chance decreases with amount of jellies active for sanity - if (NPC.ai[0] > 300 && Main.rand.NextBool(300 * NPC.CountNPCS(Type)) && NPC.ai[1] == 0) - { - SoundEngine.PlaySound(JellyGhoulScream, NPC.Center); - NPC.ai[1] = 1; - } - // While screaming, shake the screen - if (NPC.ai[1] > 0) - { - NPC.ai[1]++; - - float screenShakePower = 2 * Utils.GetLerpValue(500f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); - Main.LocalPlayer.SetScreenshake(screenShakePower); - - // After 1 second, stop shaking and set the scream on cooldown - if (NPC.ai[1] > 60) - { - NPC.ai[0] = 0; - NPC.ai[1] = 0; - } - } - // Controls enrage coloring - if (NPC.ai[2] > 0) - { - NPC.ai[2] += 0.01f; - if (NPC.ai[2] > 1f) - { - NPC.ai[2] = 1f; - } - } - if (NPC.ai[2] >= 1) - { - NPC.chaseable = true; - NPC.TargetClosest(false); - NPC.ai[3]++; - if (NPC.ai[3] >= 120 + (NPC.localAI[1] * 10)) - { - int damage = Main.masterMode ? 4 : Main.expertMode ? 6 : 8; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound with { Pitch = 1f }); - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.SafeDirectionTo(Main.player[NPC.target].Center) * 16, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); - } - NPC.ai[3] = 0; - } - } - if (Main.rand.NextBool(80)) - { - Particle ash = new SquareAshParticle(Main.rand.NextVector2FromRectangle(NPC.getRect()), new Vector2(0, 2), Main.rand.Next(100, 200), Main.rand.NextFloat(0.8f, 1.2f), new Color(50, 50, 50)); - GeneralParticleHandler.SpawnParticle(ash); - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.9f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.SpectreStaff, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.SpectreStaff, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - } - CalamityUtils.SpawnGores(NPC, "Jellyghoul", 2); - } - - public override void OnKill() - { - bool soundPlayed = false; - // Cause nearby ghouls to become angry on death - foreach (NPC n in Main.ActiveNPCs) - { - if (n.life < 0) - continue; - if (n.type != Type) - continue; - if (n.Distance(NPC.Center) > 1000) - continue; - // If the jelly isn't enraged yet, enrage it - if (n.ai[2] == 0) - { - n.ai[2] = 0.01f; - // Play a sound if at least one jelly successfully enraged - if (!soundPlayed) - { - SoundEngine.PlaySound(SoundID.Zombie83 with { Pitch = -0.5f, Volume = 1.6f }, NPC.Center); - soundPlayed = true; - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - float afterimageRotationSpeed = 1; - float afterimageDistance = 2; - float rotationMultiplier = 0.15f; - // Make the jelly visually move in circles - Vector2 afterimageOffset = new Vector2((float)Math.Cos(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1], (float)Math.Sin(Main.GlobalTimeWrappedHourly * afterimageRotationSpeed) + NPC.localAI[1]) * afterimageDistance; - - // Spooky glowey aura effect - if (!NPC.IsABestiaryIconDummy) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - - spriteBatch.Draw(bloom, NPC.Center - screenPos + afterimageOffset, null, FinalColor * 0.45f, 0f, bloom.Size() / 2f, 0.6f, SpriteEffects.None, 0); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - } - - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); - - // Rotate back and forth like a bell - float rotation = NPC.rotation + MathF.Sin(Main.GlobalTimeWrappedHourly + NPC.localAI[1]) * rotationMultiplier; - - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - - // Tentacles - Texture2D tentacle = tentacleTexture.Value; - for (int i = 0; i < 4; i++) - { - // Is the tentacle on the outside? - bool outerTentacle = i == 0 || i == 3; - // Is the tentacle one of the left ones? - int leftTentacle = i < 2 ? -1 : 1; - // Start position x offset - int xOffset = outerTentacle ? 4 : 2; - // How much the end position is rotated by - int endDeg = outerTentacle ? 20 : 5; - // Length of each tentacle - int tentacleLength = outerTentacle ? 60 : 50; - // A psuedo randomness value between tentacles and the NPC's index used to desync tentacles from each other - int randomness = i % 2 + NPC.whoAmI; - // Start position of the tentacle - Vector2 anchor = npcOffset + afterimageOffset + new Vector2(leftTentacle * xOffset, 10); - // End position of the tentacle - Vector2 end = npcOffset + afterimageOffset + Vector2.UnitY.RotatedBy(MathHelper.ToRadians(endDeg * -leftTentacle)).RotatedBy(MathHelper.ToRadians(MathF.Sin(Main.GlobalTimeWrappedHourly * 4) * 5 * -leftTentacle)) * tentacleLength; - - // Store the previous tentacle's location - Vector2 prevTentacle = npcOffset + afterimageOffset; - int segmentCount = 10; - Vector2 direction = anchor.DirectionTo(end).RotatedBy(MathHelper.PiOver2); - BezierCurve curve = new BezierCurve(anchor, anchor + (end - anchor) * 0.33f + direction * MathF.Sin(Main.GlobalTimeWrappedHourly * 4 + randomness) * 8, anchor + (end - anchor) * 0.66f + direction * MathF.Cos(Main.GlobalTimeWrappedHourly * 4 + randomness) * 16, end); - List points = curve.GetPoints(segmentCount); - for (int j = 0; j < segmentCount; j++) - { - // Which texture variant the tentacle uses is based on the horizontal position on its sheet - int texX = i == 0 ? 0 : i == (segmentCount - 1) ? 16 : 8; - // Which segment type. - // The first segment (0 is invisible) uses the first frame - // The final segment uses the last frame - // The rest alternate between frames 2 and 3 - int texY = j % 2 == 0 ? 16 : 8; - if (j == 1) - texY = 0; - else if (j == segmentCount - 1) - texY = 24; - - int segHeight = (j == segmentCount - 1) ? 8 : 6; - - if (j != 0) - spriteBatch.Draw(tentacle, points[j], new Rectangle(texX, texY, 6, segHeight), FinalColor * NPC.Opacity, points[j].DirectionTo(prevTentacle).ToRotation() + MathHelper.PiOver2, new Vector2(2), NPC.scale, spriteEffects, 0); - prevTentacle = points[j]; - } - } - - // Draws transparent clones around itself to look woozy - int cloneAmt = 4; - for (int i = 0; i < cloneAmt; i++) - { - spriteBatch.Draw(texture, npcOffset + afterimageOffset + Vector2.One.RotatedBy((i + 1) * (MathHelper.TwoPi / cloneAmt) + Main.GlobalTimeWrappedHourly + NPC.localAI[1]) * cloneAmt * MathF.Sin(Main.GlobalTimeWrappedHourly + NPC.localAI[1]), NPC.frame, FinalColor * NPC.Opacity * 0.2f, rotation, origin, NPC.scale, spriteEffects, 0f); - } - spriteBatch.Draw(texture, npcOffset + afterimageOffset, NPC.frame, FinalColor * NPC.Opacity, rotation, origin, NPC.scale, spriteEffects, 0f); - - if (!NPC.HasValidTarget) - return false; - - // Telegraph - float shotGate = 30 + (NPC.localAI[1] * 10); - float shotCompletion = (NPC.ai[3] - 90) / shotGate; - - Effect effect = Terraria.Graphics.Effects.Filters.Scene["CalamityMod:SpreadTelegraph"].GetShader().Shader; - effect.Parameters["centerOpacity"].SetValue(MathHelper.Lerp(0, 0.7f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f, shotCompletion)); - effect.Parameters["mainOpacity"].SetValue(MathHelper.Lerp(0, 1f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f, shotCompletion)); - effect.Parameters["halfSpreadAngle"].SetValue(MathHelper.Lerp(0, MathHelper.PiOver4 * 0.33f, shotCompletion)); - effect.Parameters["edgeColor"].SetValue(Color.DarkRed.ToVector3()); - effect.Parameters["centerColor"].SetValue(Color.Red.ToVector3()); - effect.Parameters["edgeBlendLength"].SetValue(0.07f); - effect.Parameters["edgeBlendStrength"].SetValue(4f); - - Main.spriteBatch.EnterShaderRegion(BlendState.Additive, effect); - - Texture2D invis = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; - - Main.EntitySpriteDraw(invis, npcOffset + afterimageOffset, null, Color.White, NPC.DirectionTo(Main.player[NPC.target].Center).ToRotation(), new Vector2(invis.Width / 2f, invis.Height / 2f), 500f, 0, 0); - - Main.spriteBatch.ExitShaderRegion(); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Jellyghoul.png b/NPCs/SunkenSea/Jellyghoul.png deleted file mode 100644 index 4ca9f182b3..0000000000 Binary files a/NPCs/SunkenSea/Jellyghoul.png and /dev/null differ diff --git a/NPCs/SunkenSea/JellyghoulTentacle.png b/NPCs/SunkenSea/JellyghoulTentacle.png deleted file mode 100644 index 573995d970..0000000000 Binary files a/NPCs/SunkenSea/JellyghoulTentacle.png and /dev/null differ diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs deleted file mode 100644 index 122f8e3d03..0000000000 --- a/NPCs/SunkenSea/KelpieSeadragon.cs +++ /dev/null @@ -1,390 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class KelpieSeadragon : SunkenSeaNPC - { - public ref float SquishX => ref NPC.localAI[0]; - public ref float SquishY => ref NPC.localAI[1]; - - public Vector2 randomPathPoint; - - public Entity currentTarget; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 400; - public static int IdleMaxPathDistance = 800; - - public static int FleeTileAnticipationDistance = 64; - - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - //ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 13; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.noGravity = true; - NPC.damage = 10; - NPC.width = 20; - NPC.height = 58; - NPC.defense = 5; - NPC.lifeMax = 150; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(silver: 5); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.15f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.KelpieSeadragon") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.3f; - MaxSpeed = 3f; - } - if (NPC.direction == 0) - { - NPC.TargetClosest(); - } - Player target = Main.player[NPC.target]; - // Fall and be useless if out of water - if (!NPC.wet) - { - NPC.ai[0] = 0; - NPC.ai[1] = 0; - NPC.velocity.X *= 0.98f; - NPC.noGravity = false; - NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.1f); - NPC.gfxOffY += 5; - return; - } - NPC.noGravity = true; - switch (NPC.ai[0]) - { - // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. - case 0: - NPC.chaseable = false; - if (NPC.velocity.Length() < 0.1f) - { - NPC.ai[1]++; - // Randomly switch direction - if (Main.rand.NextBool(120)) - { - NPC.direction *= -1; - } - // Move in a random direction towards the direction the horse is facing - if (NPC.ai[1] > 120 || Main.rand.NextBool(90)) - { - Vector2 direction = new Vector2(NPC.direction * 30, Main.rand.Next(-30, 30)); - direction = direction.SafeNormalize(Vector2.Zero); - NPC.velocity = direction * 2; - NPC.ai[1] = 0; - } - } - // Reset any rotation from aggressive AI - NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); - NPC.velocity *= 0.99f; - break; - case 1: - currentTarget = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - if (currentTarget == null) - { - NPC.ai[0] = 0; - NPC.ai[1] = 0; - SquishX = 0; - SquishY = 0; - break; - } - if (currentTarget is Player) - NPC.chaseable = true; - bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1); - // If the target is too far from its shooting range or a tile is in the way, move closer - if ((currentTarget.Distance(NPC.Center) > 300 || !hasSight) || currentTarget is NPC) - { - NPC.ai[1] = 0; - - bool huntReady = NPC.ai[2] == 0; - if (huntReady) - NPC.ai[2] = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, currentTarget.Center, SunkenSeaTileValidity), forceNewTask: huntReady); - - NPC.ai[2]--; - - NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.direction * MathHelper.PiOver4 / 2, 0.05f); - } - else - { - // Otherwise sit at a distance and fire projectiles - NPC.velocity *= 0.9f; - NPC.ai[1]++; - int fireRate = 30; // Do not change this without adjusting the frame rate as well - float currentTime = NPC.ai[1] % 36; - if (currentTime == fireRate) - { - SoundEngine.PlaySound(Sounds.CommonCalamitySounds.ExoPlasmaShootSound with { Volume = 0.2f, Pitch = 1.8f }, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 spawnPos = new Vector2(NPC.Center.X + NPC.direction * 18, NPC.position.Y + 22); - Vector2 projSpeed = spawnPos.DirectionTo(currentTarget.Center).SafeNormalize(Vector2.Zero) * 6; - Projectile.NewProjectile(NPC.GetSource_FromThis(), spawnPos, projSpeed, ModContent.ProjectileType(), 10, 0f); - } - } - // Squash and stretch - int shotTime = 24; // When to squash - if (currentTime < 24) - { - SquishX = MathHelper.Lerp(SquishX, 0.9f, currentTime / shotTime); - SquishY = MathHelper.Lerp(SquishY, 1.05f, currentTime / shotTime); - } - else - { - SquishX = MathHelper.Lerp(SquishX, 1.35f, (currentTime - shotTime) / (fireRate - shotTime)); - SquishY = MathHelper.Lerp(SquishY, 0.85f, (currentTime - shotTime) / (fireRate - shotTime)); - } - - NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); - } - if (Math.Abs(NPC.velocity.X) > 0) - { - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - } - else - { - NPC.direction = NPC.Center.X > currentTarget.Center.X ? -1 : 1; - } - break; - case 2: - { - // If the avoided entity is gone, go back to idling. - if (CurrentPredator == null) - { - NPC.ai[0] = 0; - break; - } - - if (Math.Abs(NPC.velocity.X) > 0) - { - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - } - else - { - NPC.direction = NPC.Center.X > CurrentPredator.Center.X ? -1 : 1; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - break; - } - } - NPC.spriteDirection = NPC.direction; - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - return; - NPC.frameCounter++; - if (NPC.frameCounter > 5) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - // Anger - if (NPC.ai[0] == 1 && NPC.ai[1] > 0) - { - if (NPC.frame.Y > 12 * frameHeight || NPC.frame.Y < frameHeight * 7) - { - NPC.frame.Y = frameHeight * 7; - } - } - // Idle - else - { - if (NPC.frame.Y > 6 * frameHeight) - { - NPC.frame.Y = 0; - } - } - } - - protected override void OnPlayerDetection(Player player) - { - if (CurrentPrey is null && CurrentPredator is null) - { - EnterAttackMode(); - currentTarget = player; - } - } - - protected override void OnPredatorDetection(NPC predator) - { - NPC.ai[0] = 2; - NPC.ai[1] = 0; - currentTarget = null; - } - - protected override void OnPreyDetection(NPC prey) - { - if (CurrentPredator == null) - { - EnterAttackMode(); - currentTarget = prey; - } - } - - public void EnterAttackMode() - { - NPC.ai[0] = 1; - NPC.ai[1] = 0; - SquishX = 0.9f; - SquishY = 1.05f; - } - - public override void AwaitingPathBehavior() - { - Player target = Main.player[NPC.target]; - bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1); - if (NPC.ai[0] == 1f && (currentTarget.Distance(NPC.Center) > 300 || !hasSight || currentTarget is NPC)) - { - if (currentTarget != null) - { - NPC.velocity += NPC.DirectionTo(currentTarget.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPredator || n == CurrentPrey) && Vector2.DistanceSquared(NPC.Center, n.Center) < 900f * 900f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f; - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type) || attacker.type == ModContent.NPCType(); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.7f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Asset tex = TextureAssets.Npc[Type]; - SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 stretch = NPC.ai[0] == 1 && NPC.ai[1] > 0 ? new Vector2(SquishX, SquishY) : Vector2.One; - spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColor, NPC.rotation, new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]), NPC.scale * stretch, fx, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/KelpieSeadragon.png b/NPCs/SunkenSea/KelpieSeadragon.png deleted file mode 100644 index c42bfe0083..0000000000 Binary files a/NPCs/SunkenSea/KelpieSeadragon.png and /dev/null differ diff --git a/NPCs/SunkenSea/LazarusLampfish.cs b/NPCs/SunkenSea/LazarusLampfish.cs deleted file mode 100644 index 62e5b3a275..0000000000 --- a/NPCs/SunkenSea/LazarusLampfish.cs +++ /dev/null @@ -1,395 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class LazarusLampfish : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Attacking = 1, - Fleeing = 2 - } - - public static Asset cooldownTexture; - public static Asset attackTexture; - - public Vector2 randomPathPoint; - - public Entity currentTarget; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 100; - public static int IdleMaxPathDistance = 800; - - public static int FleeTileAnticipationDistance = 64; - - public ref float CurrentPhase => ref NPC.ai[0]; - public ref float Timer => ref NPC.ai[1]; - - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - public static List PredatorList => new List() - { - ModContent.NPCType(), - }; - - protected override List PredatorIDs => PredatorList; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - - public override void Load() - { - cooldownTexture = ModContent.Request(Texture + "Cooldown"); - attackTexture = ModContent.Request(Texture + "Attack"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.noGravity = true; - NPC.damage = 40; - NPC.width = 50; - NPC.height = 30; - NPC.defense = 12; - NPC.lifeMax = 400; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(silver: 10); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.1f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LazarusLampfish") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.2f; - MaxSpeed = 3f; - } - if (NPC.direction == 0) - { - NPC.TargetClosest(); - } - Player target = Main.player[NPC.target]; - // Fall and be useless if out of water - if (!NPC.wet) - { - CurrentPhase = (int)PhaseType.Idle; - Timer = 0; - NPC.velocity.X *= 0.98f; - NPC.noGravity = false; - return; - } - NPC.noGravity = true; - switch (CurrentPhase) - { - // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. - case (int)PhaseType.Idle: - NPC.chaseable = false; - NPC.ai[2]--; - if (CurrentPredator != null || CurrentPlayer != null) - { - EnterAttackMode(); - } - if (CurrentPrey != null) - { - bool huntReady = NPC.ai[2] == 0; - if (huntReady) - NPC.ai[2] = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity), forceNewTask: huntReady); - } - else - { - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - break; - case (int)PhaseType.Attacking: - currentTarget = CurrentPredator != null ? CurrentPredator : CurrentPlayer; - if (currentTarget == null) - { - CurrentPhase = (int)PhaseType.Idle; - Timer = 0; - NPC.ai[2] = 0; - MaxSpeed = 3; - Acceleration = 0.2f; - break; - } - MaxSpeed = 8; - Acceleration = 0.3f; - NPC.chaseable = true; - bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, currentTarget.Center, 1, 1); - // If the target is too far from its shooting range or a tile is in the way, move closer - if (currentTarget.Distance(NPC.Center) > 200 || !hasSight) - { - bool restart = NPC.ai[2] == 0; - if (restart) - NPC.ai[2] = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, currentTarget.Center, SunkenSeaTileValidity), forceNewTask: restart); - - NPC.ai[2]--; - } - // If close enough, start the timer for the flash - else if (Timer == 0) - { - Timer = 1; - } - // Flash! - if (Timer >= 1) - { - NPC.velocity *= 0.92f; - Timer++; - if (Timer == 60) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center + (NPC.rotation - (NPC.spriteDirection == 1 ? 0 : MathHelper.Pi)).ToRotationVector2() * 40, Vector2.Zero, ModContent.ProjectileType(), 20, 1); - } - SoundEngine.PlaySound(SoundID.NPCDeath7 with { Pitch = 0.4f }, NPC.Center); - } - if (Timer >= 120) - { - Timer = 0; - NPC.ai[2] = 0; - CurrentPhase = (int)PhaseType.Fleeing; - } - } - break; - case (int)PhaseType.Fleeing: - { - // If the avoided entity is gone, go back to idling. - currentTarget = CurrentPredator != null ? CurrentPredator : CurrentPlayer; - if (currentTarget == null || Timer > 300) - { - CurrentPhase = currentTarget != null ? (int)PhaseType.Attacking : (int)PhaseType.Idle; - Timer = 0; - MaxSpeed = 3; - Acceleration = 0.2f; - NPC.ai[2] = currentTarget != null ? 0 : 120; - break; - } - if (Timer == 0) - { - NPC.spriteDirection = NPC.direction *= -1; - } - Timer++; - MaxSpeed = 8; - Acceleration = 0.4f; - - if (Math.Abs(NPC.velocity.X) > 0) - { - NPC.direction = NPC.velocity.X > 0 ? 1 : -1; - } - else - { - NPC.direction = NPC.Center.X > currentTarget.Center.X ? -1 : 1; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(currentTarget.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(currentTarget.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, currentTarget.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - break; - } - } - if (!(Timer >= 1 && CurrentPhase == (int)PhaseType.Attacking) && !(Timer < 3 && CurrentPhase == (int)PhaseType.Fleeing)) - { - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - } - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - return; - NPC.frameCounter++; - if (NPC.frameCounter > 5) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) - { - NPC.frame.Y = 0; - } - } - - protected override void OnPlayerDetection(Player player) - { - EnterAttackMode(); - } - - protected override void OnPredatorDetection(NPC predator) - { - EnterAttackMode(); - } - - public void EnterAttackMode() - { - CurrentPhase = (int)PhaseType.Attacking; - Timer = 0; - NPC.ai[2] = 0; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPredator || n == CurrentPrey) && Vector2.DistanceSquared(NPC.Center, n.Center) < 700f * 700f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || (p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void AwaitingPathBehavior() - { - bool hasSight = false; - if (currentTarget != null) - hasSight = Collision.CanHitLine(NPC.Center, 1, 1, currentTarget.Center, 1, 1); - if (CurrentPhase == (int)PhaseType.Idle && CurrentPrey != null || CurrentPhase == (int)PhaseType.Attacking && currentTarget.Distance(NPC.Center) > 200 || !hasSight) - { - if (CurrentPrey != null) - { - NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if ((spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } - } - CalamityUtils.SpawnGores(NPC, "LazarusLampfish", 3); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Asset tex = TextureAssets.Npc[Type]; - Rectangle frame = NPC.frame; - Vector2 origin = new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]); - - if (CurrentPhase == (int)PhaseType.Attacking && Timer > 0) - { - tex = attackTexture; - frame = tex.Frame(1, 11, 0, (int)MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, 120, Timer, true))); - origin = new Vector2(tex.Width() / 2, tex.Height() / 22); - } - if (CurrentPhase == (int)PhaseType.Fleeing) - { - tex = cooldownTexture; - frame = tex.Frame(1, 4, 0, (int)MathHelper.Lerp(0, 3, Utils.GetLerpValue(0, 24, Timer % 24, true))); - origin = new Vector2(tex.Width() / 2, tex.Height() / 8); - } - SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), frame, drawColor, NPC.rotation, origin, NPC.scale, fx, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/LazarusLampfish.png b/NPCs/SunkenSea/LazarusLampfish.png deleted file mode 100644 index 8d06df2008..0000000000 Binary files a/NPCs/SunkenSea/LazarusLampfish.png and /dev/null differ diff --git a/NPCs/SunkenSea/LazarusLampfishAttack.png b/NPCs/SunkenSea/LazarusLampfishAttack.png deleted file mode 100644 index d143d51cbb..0000000000 Binary files a/NPCs/SunkenSea/LazarusLampfishAttack.png and /dev/null differ diff --git a/NPCs/SunkenSea/LazarusLampfishCooldown.png b/NPCs/SunkenSea/LazarusLampfishCooldown.png deleted file mode 100644 index 48eba44b4d..0000000000 Binary files a/NPCs/SunkenSea/LazarusLampfishCooldown.png and /dev/null differ diff --git a/NPCs/SunkenSea/Leerslug.cs b/NPCs/SunkenSea/Leerslug.cs deleted file mode 100644 index ef53844377..0000000000 --- a/NPCs/SunkenSea/Leerslug.cs +++ /dev/null @@ -1,311 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Particles; -using System; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Leerslug : ModNPC - { - public enum PhaseType - { - Idle = 0, - Rawr = 1, - Jumps = 2, - Dash = 3 - } - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - /// - /// Handles the visual scale for the slug - /// - public Vector2 squish = new Vector2(); - public Player Target => Main.player[NPC.target]; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 5; - } - public override void SetDefaults() - { - NPC.aiStyle = -1; - NPC.damage = 30; - NPC.width = 56; - NPC.height = 30; - NPC.defense = 3; - NPC.lifeMax = 200; - NPC.knockBackResist = 0.2f; - NPC.value = Item.buyPrice(silver: 1); - NPC.lavaImmune = true; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit50; - NPC.DeathSound = SoundID.NPCDeath53; - NPC.GravityIgnoresLiquid = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToWater = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - squish = reader.ReadVector2(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(squish); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Leerslug") - }); - } - - public override void AI() - { - NPC.Calamity().newAI[1]++; - NPC.TargetClosest(false); - Lighting.AddLight(NPC.Center, 0.5f, 0.2f, 0); - if (NPC.direction == 0) - { - NPC.direction = Main.rand.NextBool().ToDirectionInt(); - squish = Vector2.One; - } - switch (CurrentPhase) - { - case (int)PhaseType.Idle: - { - // Flip direction and slow down if it's still moving from a previous cycle - if (Timer == 0 && Main.rand.NextBool()) - { - NPC.direction *= -1; - NPC.velocity.X *= 0.9f; - } - // Move horizontally in short bursts - else if (Timer >= Main.rand.Next(30, 90) && NPC.velocity.Y == 0 && Math.Abs(NPC.velocity.X) < 1 && NPC.ai[2] == 0) - { - NPC.ai[2] = 1; - NPC.velocity.X = Main.rand.NextFloat(2, 4) * Main.rand.NextBool().ToDirectionInt(); - } - - // Increment the timer before the burst ends - if (NPC.ai[2] == 1) - { - NPC.ai[3]++; - } - // Slowdown after a burst - else if (NPC.ai[2] == 2 && NPC.velocity.Y == 0) - { - NPC.velocity.X *= 0.9f; - NPC.ai[3]++; - } - - // Handle movement states - if (NPC.ai[3] > Main.rand.Next(20, 40)) - { - // If the slug is moving, enter slowdown - if (NPC.ai[2] == 1) - NPC.ai[2] = 2; - // If the slug is in slowdown, reset - else if (NPC.ai[2] == 2) - ChangePhase((int)PhaseType.Idle); - NPC.ai[3] = 0; - } - - NPC.direction = NPC.velocity.X.DirectionalSign(); - - // Aggro - if (Target.active && Target.Distance(NPC.Center) < 400 && NPC.HasSight(Target.Center)) - { - ChangePhase((int)PhaseType.Rawr); - } - } - break; - case (int)PhaseType.Rawr: - { - int roar = 40; - int startAI = 70; - NPC.velocity.X *= 0.9f; - // Roar in place with a lil jump - if (Timer == roar) - { - SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); - if (NPC.velocity.Y == 0) - { - NPC.velocity.Y = -3; - } - } - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - if (Timer > startAI) - ChangePhase(Main.rand.NextBool() ? (int)PhaseType.Jumps : (int)PhaseType.Dash); - } - break; - case (int)PhaseType.Jumps: - { - // Do a few hops towards the player - int maxJumps = 3; - int jumpHeight = Target.Bottom.Y < NPC.Top.Y ? 8 : 5; - if (NPC.ai[2] >= maxJumps - 1 && NPC.velocity.Y == 0) - { - ChangePhase((int)PhaseType.Dash); - } - // Jump - if (NPC.velocity.Y == 0) - { - NPC.velocity.Y = -jumpHeight; - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 4; - NPC.ai[2]++; - } - // Move towards the player if it fell in lava - else if (NPC.lavaWet) - { - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 4; - if (Main.rand.NextBool(20)) - { - SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); - } - } - NPC.direction = NPC.velocity.X.DirectionalSign(); - } - break; - case (int)PhaseType.Dash: - { - // Squash and stretch to telegraph the dash - int squash = 30; - int stretch = 10; - Vector2 squashAmt = new Vector2(0.6f, 1.5f); - RawrAnimation(squash, stretch, squashAmt); - // Slow down before dashing - if (Timer < squash + 10) - { - NPC.velocity.X *= 0.95f; - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - } - // Dash - else if (Timer == squash + 10) - { - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 6; - SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, NPC.Center); - } - // Leave behind some hot mist particles - else - { - if (NPC.velocity.X == 0) - { - ChangePhase((int)PhaseType.Jumps); - break; - } - if (Timer < squash + 60) - { - if (Timer % 2 == 0) - { - MediumMistParticle particle = new MediumMistParticle(NPC.Center, -NPC.velocity, Color.Red, Color.Orange, Main.rand.NextFloat(0.8f, 1.2f), 255f, 0.2f); - GeneralParticleHandler.SpawnParticle(particle); - } - } - NPC.direction = NPC.velocity.X.DirectionalSign(); - } - if (Timer > 120 && NPC.velocity.Y == 0) - ChangePhase((int)PhaseType.Jumps); - } - break; - } - NPC.StepUpBlocks(); - NPC.spriteDirection = NPC.direction; - // Bounce on lava - if (NPC.lavaWet) - { - NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); - } - Timer++; - } - - public void RawrAnimation(int squashDuration, int stretchDuration, Vector2 squashAmt) - { - int squash = squashDuration; - int stretch = squash + stretchDuration; - // rawrxd - if (Timer == squash) - { - SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); - } - // Squash - if (Timer < squash) - { - squish.X = MathHelper.Lerp(1, squashAmt.X, Utils.GetLerpValue(0, squash, Timer, true)); - squish.Y = MathHelper.Lerp(1, squashAmt.Y, Utils.GetLerpValue(0, squash, Timer, true)); - } - // Stretch - else if (Timer >= squash && Timer < stretch) - { - squish.X = MathHelper.Lerp(squashAmt.X, 1, Utils.GetLerpValue(squash, stretch, Timer, true)); - squish.Y = MathHelper.Lerp(squashAmt.Y, 1, Utils.GetLerpValue(squash, stretch, Timer, true)); - } - } - - public void ChangePhase(int phaseNum, bool resetai2 = true, bool resetai3 = true) - { - CurrentPhase = phaseNum; - Timer = 0; - if (resetai2) - NPC.ai[2] = 0; - if (resetai3) - NPC.ai[3] = 0; - NPC.netUpdate = true; - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LavaMoss, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "Leerslug", 2); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; - - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale * squish, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Leerslug.png b/NPCs/SunkenSea/Leerslug.png deleted file mode 100644 index 69dba75efd..0000000000 Binary files a/NPCs/SunkenSea/Leerslug.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs deleted file mode 100644 index b337deb76b..0000000000 --- a/NPCs/SunkenSea/LostShoal.cs +++ /dev/null @@ -1,442 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent; -using Terraria.DataStructures; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class LostShoal : ModNPC - { - public static Asset RedTexture; - public static Asset BlueTexture; - public static Asset GoldTexture; - - public float RandomOpacityOffset; - public ref float Variant => ref NPC.ai[1]; - public ref float Leader => ref NPC.ai[2]; - public ref float Role => ref NPC.ai[3]; - - public enum ShoalColor - { - Red = 0, - Blue = 1, - Green = 2, - Gold = 3 - } - - public override void Load() - { - RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalRed"); - BlueTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalBlue"); - GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalGold"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 8; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.CountsAsCritter[Type] = true; - } - - public override void SetDefaults() - { - NPC.npcSlots = 0.1f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 36; - NPC.height = 22; - NPC.defense = 0; - NPC.lifeMax = 1; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = null; - NPC.DeathSound = SoundID.NPCDeath6; - NPC.noTileCollide = true; - NPC.alpha = 120; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.catchItem = ItemID.AshBlock; // yeah this is intentional - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LostShoal") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // Randomize the color of the fish - Variant = Main.rand.Next(0, 3); - if (Main.rand.NextBool(50)) - { - Variant = (int)ShoalColor.Gold; - NPC.catchItem = ItemID.GoldCoin; - } - - RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); - NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); - } - - public override void AI() - { - // swim normally if the fish is the leader of the shoal - if (Role != 1) - { - LeaderMovement(); - if (NPC.direction == 0) - { - NPC.direction = Main.rand.NextBool(2) ? 1 : -1; - } - if (Main.rand.NextBool(1200)) - { - NPC.direction *= -1; - } - } - else - { - NPC owner = Main.npc[(int)Leader]; - // if the owner of the shoal isn't a lost shoal or is dead, find a new shoal to attach to - if (!owner.active || owner.type != ModContent.NPCType()) - { - bool anyShoals = false; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC n = Main.npc[k]; - if (!n.active) - continue; - if (owner.type == ModContent.NPCType()) - { - // if a nearby shoal leader is found, go follow it - if (Role != 1 && n.Distance(NPC.position) < 1200) - { - anyShoals = true; - Leader = n.whoAmI; - } - } - } - // if no leaders are found nearby, a new leader is picked - if (!anyShoals) - { - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC n = Main.npc[k]; - if (!n.active) - continue; - if (owner.type == ModContent.NPCType()) - { - if (n.Distance(NPC.position) < 1200) - { - // the found fish becomes the new leader, and this fish becomes a member of its school - n.ai[3] = 2; - Leader = n.whoAmI; - } - } - } - } - } - NPC.velocity = owner.velocity; - NPC.direction = owner.direction; - NPC.spriteDirection = owner.spriteDirection; - // gather behind the leader - // basically a pet - // if we want to make the fish scared of players or other predators, then set enemyClose to true. For now this is commented out. - //NPC.TargetClosest(false); - //bool enemyClose = Main.player[NPC.target] != null && Main.player[NPC.target].active && Main.player[NPC.target].Distance(NPC.position) < 128; - bool enemyClose = false; - float SAImovement = enemyClose ? 0.02f : 0.1f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || owner.type != ModContent.NPCType()) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - } - NPC.noGravity = true; - // leaders will naturally spawn a school of followers upon spawning - if (Role == 0) - { - // the amount of fish to spawn - int fishCount = Main.rand.Next(3, 6); - for (int i = 0; i < fishCount; i++) - { - int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); - Main.npc[n].ai[3] = 1; // the 1 means that the spawned fish will not be a leader, and will not spawn even more fish - Main.npc[n].ai[2] = NPC.whoAmI; // marks this fish as the owner of the spawned fish - } - Role = 2; // don't spawn any more fish - } - // leaders are a tiny bit more brighter - float intensity = Role == 1 ? 0.002f : 0.004f; - Color glowColor = new(0.983f, 1f, 0.78f); - switch (Variant) - { - case (int)ShoalColor.Blue: - glowColor = new(0.78f, 0.77f, 0.988f); - break; - case (int)ShoalColor.Red: - glowColor = new(1f, 0.83f, 0.819f); - break; - case (int)ShoalColor.Gold: - glowColor = new(1f, 1f, 0.678f); - break; - } - Lighting.AddLight(NPC.Center, glowColor.R * intensity, glowColor.G * intensity, glowColor.B * intensity); - // Formerly, sprinkle down ash particles - // Now they trail glowing dust as they move - // Keeping it as reference in case i want to use it somewhere else (i will) - if (Main.rand.NextBool(120)) - { - //Color ashColor = new(40, 48, 41); - int dustid = DustID.CoralTorch; - switch (Variant) - { - case (int)ShoalColor.Blue: - //ashColor = new(44, 63, 66); - dustid = DustID.BoneTorch; - break; - case (int)ShoalColor.Red: - //ashColor = new(79, 41, 42); - dustid = DustID.CrimsonTorch; - break; - case (int)ShoalColor.Gold: - //ashColor = Color.Yellow; - dustid = DustID.IchorTorch; - break; - } - //Particle ash = new SquareAshParticle(NPC.Center, new Vector2(0, 4), 150, Main.rand.NextFloat(0.85f, 1f), ashColor); - //GeneralParticleHandler.SpawnParticle(ash); - - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); - dust.velocity = Vector2.Zero; - } - if (Variant == (int)ShoalColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - public void LeaderMovement() - { - // This is just usual swimmer ai with some modifications - NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; - - NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.06f; - NPC.noGravity = true; - if (NPC.collideX) - { - NPC.velocity.X = NPC.velocity.X * -1f; - NPC.direction *= -1; - NPC.netUpdate = true; - } - if (NPC.collideY) - { - NPC.netUpdate = true; - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; - NPC.directionY = -1; - NPC.ai[0] = -1f; - } - else if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y); - NPC.directionY = 1; - NPC.ai[0] = 1f; - } - } - if (NPC.Calamity().newAI[0] <= 0 && NPC.Distance(Main.player[NPC.target].Center) > (45 * 16)) - { - //NPC.velocity.X *= -1; - NPC.direction *= -1; - NPC.Calamity().newAI[0] = 300; - } - NPC.Calamity().newAI[0] -= 1; - // No target behavior - NPC.velocity.X += (float)NPC.direction * 0.02f; - if (NPC.velocity.X < -1.5f || NPC.velocity.X > 1.5f) - { - NPC.velocity.X *= 0.95f; - } - if (NPC.ai[0] == -1f) - { - NPC.velocity.Y -= 0.01f; - if (NPC.velocity.Y < -0.3f) - { - NPC.ai[0] = 1f; - } - } - else - { - NPC.velocity.Y += 0.01f; - if (NPC.velocity.Y > 0.3f) - { - NPC.ai[0] = -1f; - } - } - int NPCTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; - int NPCTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; - if (Main.tile[NPCTileX, NPCTileY - 1].LiquidAmount > 128) - { - if (Main.tile[NPCTileX, NPCTileY + 1].HasTile) - { - NPC.ai[0] = -1f; - } - else if (Main.tile[NPCTileX, NPCTileY + 2].HasTile) - { - NPC.ai[0] = -1f; - } - } - if (NPC.velocity.Y > 0.4f || NPC.velocity.Y < -0.4f) - { - NPC.velocity.Y = NPC.velocity.Y * 0.95f; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += 0.2f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Player.Calamity().clamity && !NPC.AnyNPCs(Type)) - { - return 0.125f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - int goreType = Main.rand.Next(11, 14); - Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-10, 11) * 0.2f, Main.rand.Next(-10, 11) * 0.2f), goreType, 0.2f); - } - } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - // Gold shoals drop Gold Coins instead of ash when caught - // The shoal drops 1 coin by default while the extra coins are spawned here in a spread - if (!failed) - { - if (Variant == (int)ShoalColor.Gold) - { - for (int i = 0; i < Main.rand.Next(0, 5); i++) - { - Item.NewItem(NPC.GetSource_CatchEntity(NPC), NPC.getRect(), ItemID.GoldCoin); - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - // Spooky glowey aura effect - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Color glowColor = Color.SeaGreen; - switch (Variant) - { - case (int)ShoalColor.Blue: - glowColor = Color.Cyan; - break; - case (int)ShoalColor.Red: - glowColor = Color.Pink; - break; - case (int)ShoalColor.Gold: - glowColor = Color.Yellow; - break; - } - - spriteBatch.Draw(bloom, NPC.Center - Main.screenPosition, null, glowColor * 0.45f, 0f, bloom.Size() / 2f, 0.3f, SpriteEffects.None, 0); - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - // Regular stuff for drawing the actual fish and its afterimages - Texture2D texture = TextureAssets.Npc[Type].Value; - switch (Variant) - { - case (int)ShoalColor.Blue: - texture = BlueTexture.Value; - break; - case (int)ShoalColor.Red: - texture = RedTexture.Value; - break; - case (int)ShoalColor.Gold: - texture = GoldTexture.Value; - break; - } - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); - Color white = Color.White; - float colorLerpAmt = 0.5f; - int afterimageAmt = 7; - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += 2) - { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (float)(afterimageAmt - i) / 15f; - Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - } - } - - float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3f + RandomOpacityOffset) / 2f + 0.5f; - - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, npcOffset, NPC.frame, drawColor * MathHelper.Lerp(0.4f, 0.8f, sine), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/LostShoal.png b/NPCs/SunkenSea/LostShoal.png deleted file mode 100644 index 00bfd5303b..0000000000 Binary files a/NPCs/SunkenSea/LostShoal.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoalBlue.png b/NPCs/SunkenSea/LostShoalBlue.png deleted file mode 100644 index 8d9eaecff9..0000000000 Binary files a/NPCs/SunkenSea/LostShoalBlue.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoalGold.png b/NPCs/SunkenSea/LostShoalGold.png deleted file mode 100644 index e868c21047..0000000000 Binary files a/NPCs/SunkenSea/LostShoalGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/LostShoalRed.png b/NPCs/SunkenSea/LostShoalRed.png deleted file mode 100644 index 9a759540c3..0000000000 Binary files a/NPCs/SunkenSea/LostShoalRed.png and /dev/null differ diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs deleted file mode 100644 index 2c05c81d00..0000000000 --- a/NPCs/SunkenSea/Pearlpod.cs +++ /dev/null @@ -1,422 +0,0 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.Enums; -using System.Collections.Generic; -using System; - -namespace CalamityMod.NPCs.SunkenSea -{ - public abstract class Pearlpod : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Eating = 1, - Fleeing = 2, - Hiding = 3 - } - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List(); - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - - public abstract float SpawnRate { get; } - public abstract int ItemType { get; } - - public abstract string GoreName { get; } - - public ref float CurrentPhase => ref NPC.Calamity().newAI[0]; - - public ref float BiteCount => ref NPC.Calamity().newAI[1]; - - public NPC clam => NPC.Calamity().newAI[2] == 0 ? null : Main.npc[(int)NPC.Calamity().newAI[2] - 1]; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = NPCAIStyleID.Snail; - NPC.damage = 0; - NPC.width = 30; - NPC.height = 30; - NPC.defense = 0; - NPC.lifeMax = 20; - NPC.knockBackResist = 0f; - NPC.lavaImmune = false; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.GravityIgnoresLiquid = true; - NPC.catchItem = ItemType; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 3; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 3; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Pearlpod") - }); - } - - public override void AI() - { - bool predatorAvailable = CurrentPredator != null || CurrentPlayer != null; - Tile vine = CalamityUtils.ParanoidTileRetrieval((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - if (CurrentPhase < 2) - { - // Set newAI[0] to 1 if the Pearlpod is inside of a vine - if (vine.TileType == ModContent.TileType() && !NPC.justHit) - { - CurrentPhase = (int)PhaseType.Eating; - } - // Otherwise reset eating-related variables - else - { - BiteCount = 0; - CurrentPhase = (int)PhaseType.Idle; - } - } - - switch (CurrentPhase) - { - // :literallynothing: - case (int)PhaseType.Idle: - { - } - break; - // Eat kelp if found - case (int)PhaseType.Eating: - { - NPC.velocity.X *= 0.1f; - // Play a crunch sound and spawn some grass dust randomly - if (Main.rand.NextBool(20)) - { - SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = 1.2f }, NPC.Center); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); - } - BiteCount++; - } - // After munching 10 times, the vine is broken and the Pearlpod continues about its day - if (BiteCount == 10) - { - if (vine.TileType == ModContent.TileType()) - { - WorldGen.KillTile((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - } - } - } - break; - // Run into a clam - case (int)PhaseType.Fleeing: - { - BiteCount = 0; - bool clamValid = IsClamValid(); - // Stop running if the threat is gone - if (!predatorAvailable) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.ShowNameOnHover = true; - ResetClam(); - break; - } - // Look for a clam if the current clam is no longer valid - if (!clamValid) - { - LookForClam(); - } - else - { - // Run boy run! - NPC.velocity.X = NPC.DirectionTo(clam.Center).X.DirectionalSign() * 3; - NPC.direction = NPC.velocity.X.DirectionalSign(); - NPC.StepUpBlocks(); - - // Minimum distances on both axes. Y is higher in case there's a ledge - Vector2 dif = NPC.Center - clam.Center; - bool xClose = Math.Abs(dif.X) < 20; - bool yClose = Math.Abs(dif.Y) < 60; - - // Enter the clam if close enough - if (xClose && yClose) - { - CurrentPhase = (int)PhaseType.Hiding; - } - // If close enough horizontally, but not vertically, jump - else if (xClose && !yClose && NPC.Center.Y < clam.Center.Y && NPC.velocity.Y == 0) - { - NPC.velocity.Y -= 4; - } - } - } - break; - // Hide inside a clam - case (int)PhaseType.Hiding: - { - BiteCount = 0; - bool clamValid = IsClamValid(); - // Exit the clam if the threat is gone - if (!predatorAvailable) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.ShowNameOnHover = true; - ResetClam(); - break; - } - // If the clam is gone, exit the dead clam - if (!clamValid) - { - LookForClam(); - if (!IsClamValid()) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.ShowNameOnHover = true; - ResetClam(); - } - } - // True hiding behaviour - else - { - // Become invisible - if (NPC.Opacity > 0) - NPC.Opacity -= 0.2f; - // When fully invisible lock into the clam's position - if (NPC.Opacity <= 0) - NPC.Center = clam.Center; - NPC.dontTakeDamage = true; - NPC.ShowNameOnHover = false; - } - } - break; - } - // Reset hiding stuff when not in danger - if (CurrentPhase < 2) - { - if (predatorAvailable && !IsClamValid()) - LookForClam(); - } - if (CurrentPhase != (int)PhaseType.Hiding) - { - if (NPC.Opacity < 1) - { - NPC.Opacity += 0.3f; - if (NPC.Opacity > 1) - NPC.Opacity = 1; - } - NPC.dontTakeDamage = false; - } - } - - /// - /// Puts the clam back into idle state - /// - public void ResetClam() - { - if (IsClamValid()) - { - clam.localAI[2] = 0; - Clam clamMod = clam.ModNPC(); - clamMod.ChangePhase((int)Clam.PhaseType.Idle); - clamMod.ShellRotation = MathHelper.ToRadians(60); - NPC.netUpdate = true; - clam.netUpdate = true; - } - } - - /// - /// Check if a clam is valid to hide in - /// - /// - public bool IsClamValid() - { - if (clam == null || !clam.active || clam.life < 0 || clam.type != ModContent.NPCType() || clam.localAI[2] <= 0 || (clam.ai[0] > 0 && clam.ai[0] < 3)) - { - return false; - } - return true; - } - - /// - /// Look for a clam - /// - public void LookForClam() - { - // Don't bother running the searches if no clams exist - if (NPC.AnyNPCs(ModContent.NPCType())) - { - NPC nearestClam = null; - foreach (NPC n in Main.ActiveNPCs) - { - float dist = Vector2.Distance(NPC.Center, n.Center); - // Find the nearest clam in a 200px radius which the pearlpod is able to see and doesn't already have a pearlpod going after it - if (dist < 200f && NPC.HasSight(n.Center) && n.type == ModContent.NPCType() && n.localAI[2] <= 0 && n.ai[0] == 0) - { - // if no clam has been attached yet and this is the nearest clam, mark it as a candidate - if (nearestClam == null || NPC.Distance(nearestClam.Center) < dist) - { - nearestClam = n; - } - } - } - // if a clam was found, update both NPCs' variables to have them cooperate - if (nearestClam != null) - { - nearestClam.localAI[2] = NPC.whoAmI + 1; - nearestClam.ai[0] = (int)Clam.PhaseType.Pod; - NPC.Calamity().newAI[2] = nearestClam.whoAmI + 1; - nearestClam.netUpdate = true; - NPC.netUpdate = true; - } - } - if (clam != null) - { - clam.localAI[2] = NPC.whoAmI + 1; - } - } - - protected override void OnPlayerDetection(Player player) - { - CurrentPhase = (int)PhaseType.Fleeing; - LookForClam(); - } - - protected override void OnPreyDetection(NPC prey) - { - CurrentPhase = (int)PhaseType.Fleeing; - LookForClam(); - } - - protected override bool NPCSearchFilter(NPC n) - { - return !(CurrentPhase == (int)PhaseType.Hiding && !IsClamValid()) && (base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 900f * 900f); - } - - protected override bool PlayerSearchFilter(Player p) - { - return !(CurrentPhase == (int)PhaseType.Hiding && !IsClamValid()) && (base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 3) - { - NPC.frame.Y = 0; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * SpawnRate; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, GoreName, 3); - } - } - - public class PearlpodWhite : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 4; - } - public override void SetDefaults() - { - base.SetDefaults(); - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - } - public override float SpawnRate => 0.6f; - public override int ItemType => ModContent.ItemType(); - - public override string GoreName => "PearlpodWhite"; - } - public class PearlpodPink : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - Main.npcFrameCount[Type] = 4; - } - public override void SetDefaults() - { - base.SetDefaults(); - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - } - public override float SpawnRate => 0.05f; - public override int ItemType => ModContent.ItemType(); - - public override string GoreName => "PearlpodPink"; - } - public class PearlpodBlack : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - Main.npcFrameCount[Type] = 4; - } - public override void SetDefaults() - { - base.SetDefaults(); - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - } - public override float SpawnRate => 0.2f; - public override int ItemType => ModContent.ItemType(); - - public override string GoreName => "PearlpodBlack"; - } -} diff --git a/NPCs/SunkenSea/PearlpodBlack.png b/NPCs/SunkenSea/PearlpodBlack.png deleted file mode 100644 index 405f8278dd..0000000000 Binary files a/NPCs/SunkenSea/PearlpodBlack.png and /dev/null differ diff --git a/NPCs/SunkenSea/PearlpodPink.png b/NPCs/SunkenSea/PearlpodPink.png deleted file mode 100644 index 65ffef0598..0000000000 Binary files a/NPCs/SunkenSea/PearlpodPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/PearlpodWhite.png b/NPCs/SunkenSea/PearlpodWhite.png deleted file mode 100644 index b23e06f817..0000000000 Binary files a/NPCs/SunkenSea/PearlpodWhite.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoi.cs b/NPCs/SunkenSea/PodobooKoi.cs deleted file mode 100644 index 0278a4280a..0000000000 --- a/NPCs/SunkenSea/PodobooKoi.cs +++ /dev/null @@ -1,558 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PodobooKoi : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Flee = 1, - Hunt = 2, - Hostile = 3 - } - public enum VariantType - { - Normal = 0, - Comet = 1, - BubbleEye = 2, - Oranda = 3 - } - - public ref float CurrentVariant => ref NPC.ai[0]; - - public ref float CurrentBehavior => ref NPC.ai[1]; - - public ref float ShootTimer => ref NPC.ai[2]; - - public static int IdleMinPathDistance = 50; - public static int IdleMaxPathDistance = 600; - - public static int FleeTileAnticipationDistance = 28; - - public Vector2 randomPathPoint; - public Vector2 lavaLine = Vector2.Zero; - - public static Asset cometTex; - public static Asset bubbleEyedTex; - public static Asset orandaTex; - - protected override List PreyIDs => new List() - { - ModContent.NPCType() - }; - - protected override List PredatorIDs => new List() - { - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; - - public override void Load() - { - cometTex = ModContent.Request(Texture + "Comet"); - bubbleEyedTex = ModContent.Request(Texture + "BubbleEyed"); - orandaTex = ModContent.Request(Texture + "Oranda"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 15; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.noGravity = true; - NPC.damage = 30; - NPC.width = 32; - NPC.height = 32; - NPC.defense = 10; - NPC.lifeMax = 1000; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.lavaImmune = true; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToWater = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PodobooKoi") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // 50% chance to be one of 3 variants - if (Main.rand.NextBool()) - { - CurrentVariant = Main.rand.Next(1, 4); - } - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.5f; - MaxSpeed = 4f; - } - if (NPC.ai[3] <= 0) - { - lavaLine = FindLavaLine(); - NPC.ai[3] = 180; - } - NPC.ai[3]--; - NPC.chaseable = false; - if (NPC.lavaWet) - { - switch (CurrentBehavior) - { - case (int)PhaseType.Idle: - IdleBehavior(); - break; - case (int)PhaseType.Flee: - FleeBehavior(); - break; - case (int)PhaseType.Hunt: - HuntBehavior(); - break; - case (int)PhaseType.Hostile: - HostileBehavior(); - break; - } - } - else - { - BeachedBehavior(); - } - if (CurrentBehavior != (int)PhaseType.Hostile) - { - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - } - } - - public void IdleBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), LavaTileValidityLenient)); - } - - /// - /// Same as LavaTileValidity but without the requirement for a full tile of lava - /// - /// - /// - public bool LavaTileValidityLenient(Point point) - { - Point actualFuckingPoint = new Point(point.X * 16, point.Y * 16); - - return NPC.Hitbox.Contains(actualFuckingPoint) - || !NPC.GetIntersectingHitboxPoints( - actualFuckingPoint, 10, 10).Any(a => Main.tile[a].IsTileSolidGround() || Main.tile[a].LiquidAmount < 25 || Main.tile[a].LiquidType != LiquidID.Lava); - } - - public void FleeBehavior() - { - // If the predator is gone, go back to idling. - if (CurrentPredator == null) - { - CurrentBehavior = (int)PhaseType.Idle; - MaxSpeed = 4; - return; - } - - MaxSpeed = 8; - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, LavaTileValidityLenient)); - } - } - - public void HuntBehavior() - { - if (CurrentPrey == null) - { - MaxSpeed = 4; - CurrentBehavior = (int)PhaseType.Idle; - pathfinding.ClearResults(); - return; - } - MaxSpeed = 8; - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, LavaTileValidityLenient)); - } - - public void HostileBehavior() - { - // Reset - if (CurrentPlayer == null || !NPC.HasSight(CurrentPlayer.Center)) - { - MaxSpeed = 4; - CurrentBehavior = (int)PhaseType.Idle; - NPC.ai[2] = 0; - pathfinding.ClearResults(); - // Sometimes the fish gets stuck in air, so make it dive down when losing interest - NPC.velocity.Y = 4; - return; - } - - NPC.chaseable = true; - bool noLava = lavaLine == Vector2.Zero; - // If this is true, use its lava behavior - bool useLavaAI = CurrentPlayer.lavaWet && NPC.Distance(CurrentPlayer.Center) < 500; - // If this is true, but the above is not use its "air" behavior. This is set to true provided the fish is close enough to the lava line - bool useAirAI = false; - - // If the player is not in lava - if (lavaLine != Vector2.Zero && !CurrentPlayer.lavaWet) - { - // Use air AI if the fish is close enough to the lava line - useAirAI = NPC.Distance(lavaLine) < 80; - - // If the player is too far from the lava swim towards the player - bool farFromLava = CurrentPlayer.Distance(lavaLine) > 300; - // Distance from the destination the fish needs to be - float distNeeded = farFromLava ? 300 : 40; - - Vector2 destination = farFromLava ? new Vector2(CurrentPlayer.Center.X, lavaLine.Y) : lavaLine; - - // If it's still trying to chase the player, clear the pathfinding results - if (NPC.Calamity().newAI[0] == 1) - { - pathfinding.ClearResults(); - NPC.Calamity().newAI[0] = 0; - } - - // Go to the location if not close enough, otherwise slow down - if (NPC.Distance(destination) > distNeeded) - { - pathfinding.DoPathfinding(new(this, NPC.Center, destination)); - } - else - { - NPC.velocity *= 0.9f; - pathfinding.ClearResults(); - } - } - // If the player is in lava but far from the fish just swim to them - else if (NPC.Distance(CurrentPlayer.Center) > 150) - { - if (NPC.position == NPC.oldPosition) - { - NPC.velocity.Y = 4; - } - MaxSpeed = 6; - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPlayer.Center, LavaTileValidityLenient)); - // Mark the fish as currently trying to chase the player - NPC.Calamity().newAI[0] = 1; - } - // If the player is in lava and close to the fish just kinda float about - else - { - NPC.SimpleFlyMovement(Main.rand.NextVector2Circular(11, 11), 0.01f); - pathfinding.ClearResults(); - } - - // Normal variants fire basic projectiles - // Orandas fire a projectile that splits into 2 bouncing projectiles - // Bubble Eyes fire a projectile with some quirky homing - // Comet fires a very fast projectile - - int projType = CurrentVariant switch - { - (int)VariantType.Comet => ModContent.ProjectileType(), - (int)VariantType.Oranda => ModContent.ProjectileType(), - (int)VariantType.BubbleEye => ModContent.ProjectileType(), - _ => ModContent.ProjectileType() - }; - - int speed = CurrentVariant switch - { - (int)VariantType.Comet => 18, - (int)VariantType.Oranda => 8, - (int)VariantType.BubbleEye => 8, - _ => 10 - }; - - int fireRate = CurrentVariant switch - { - (int)VariantType.Comet => Main.rand.Next(90, 110), - (int)VariantType.Oranda => Main.rand.Next(70, 100), - (int)VariantType.BubbleEye => Main.rand.Next(80, 120), - _ => Main.rand.Next(50, 80) - }; - - float shotCompletion = Utils.GetLerpValue(0, -30, ShootTimer, true); - int soundFreq = (int)MathHelper.Lerp(10, 5, shotCompletion); - float pitch = MathHelper.Lerp(0, 0.6f, shotCompletion); - // Play bubbly sounds at increasing frequency and pitch - if (ShootTimer < 0 && ShootTimer % soundFreq == 0) - { - SoundEngine.PlaySound(SoundID.Item111 with { Pitch = pitch, MaxInstances = 0 }, NPC.Center); - // Star! - if (CurrentVariant == (int)VariantType.Comet) - { - SoundEngine.PlaySound(SoundID.Item9 with { Pitch = pitch * 0.5f + 0.2f, MaxInstances = 0, Volume = 0.4f }, NPC.Center); - } - } - - // Lava attack, directly shoot at the player - if (useLavaAI) - { - ShootTimer--; - if (ShootTimer < -30) - { - ShootTimer = fireRate; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.SafeDirectionTo(CurrentPlayer.Center, Vector2.UnitY) * speed, projType, NPC.damage, 0); - Main.projectile[p].hostile = true; - Main.projectile[p].friendly = false; - } - } - } - // Air attack, shoot projectiles at the player in arches - else if (useAirAI) - { - MaxSpeed = 4; - ShootTimer--; - - if (ShootTimer <= -40) - { - ShootTimer = fireRate; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, NPC.DirectionTo(CurrentPlayer.Center) * speed, projType, NPC.damage, 0, ai0: CurrentPlayer.whoAmI); - } - - for (int i = 0; i < 30; i++) - { - int d = Dust.NewDust(NPC.Center + NPC.DirectionTo(CurrentPlayer.Center) * NPC.width / 2, 10, 10, DustID.InfernoFork, Scale: Main.rand.NextFloat(0.8f, 1.4f)); - Main.dust[d].velocity = (NPC.DirectionTo(CurrentPlayer.Center) * Main.rand.Next(4, 10)).RotatedByRandom(Main.rand.NextFloat(-0.6f, 0.6f)); - Main.dust[d].noGravity = true; - } - - NPC.velocity.X = -NPC.DirectionTo(CurrentPlayer.Center).X * 4; - } - } - else - { - ShootTimer = 0; - } - int dir = NPC.DirectionTo(CurrentPlayer.Center).X.DirectionalSign(); - NPC.rotation = NPC.DirectionTo(CurrentPlayer.Center).ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; - } - - public Vector2 FindLavaLine() - { - Vector2? tileFoundPosition = null; - Point npcPoint = NPC.Center.ToTileCoordinates(); - for (int i = npcPoint.Y; i > npcPoint.Y - 60; i--) - { - if (!Main.tile[npcPoint.X, i].HasTile && Main.tile[npcPoint.X, i].LiquidAmount < 255) - { - tileFoundPosition = new Point(npcPoint.X, i).ToWorldCoordinates() - Vector2.UnitY * 8; - break; - } - } - - if (tileFoundPosition.HasValue) - return tileFoundPosition.Value; - - return Vector2.Zero; - } - - public void BeachedBehavior() - { - if (NPC.velocity.Y == 0f) - { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) - { - NPC.velocity.X = 0f; - } - } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) - { - NPC.velocity.Y = 10f; - } - NPC.rotation = 0; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - protected override bool PlayerSearchFilter(Player p) - { - bool lavaFilter = p.lavaWet && Vector2.DistanceSquared(NPC.Center, p.Center) < 300f * 300f; - bool airFilter = false; - bool alreadyVisible = p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f; - if (lavaLine != Vector2.Zero) - { - Vector2 lavaDist = lavaLine - p.Center; - airFilter = !p.lavaWet && p.Center.Y <= lavaLine.Y && MathF.Abs(lavaDist.Y) < 300 && MathF.Abs(lavaDist.X) < 1000; - } - return NPC.HasSight(p.Center) && (lavaFilter || airFilter || alreadyVisible); - } - - protected override void OnPlayerDetection(Player player) - { - if (CurrentBehavior == (int)PhaseType.Idle) - { - CurrentBehavior = (int)PhaseType.Hostile; - lavaLine = FindLavaLine(); - } - } - - protected override void OnPreyDetection(NPC prey) - { - if (CurrentBehavior != (int)PhaseType.Flee) - CurrentBehavior = (int)PhaseType.Hunt; - } - - protected override void OnPredatorDetection(NPC predator) - { - CurrentBehavior = (int)PhaseType.Flee; - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - { - NPC.frameCounter = 0.0; - NPC.frame.Y = 0; - return; - } - bool shooting = ShootTimer <= -1; - int interval = shooting ? 12 : 6; - NPC.frameCounter++; - if (NPC.frameCounter > interval) - { - NPC.frame.Y++; - NPC.frameCounter = 0; - } - if (shooting) - { - if (NPC.frame.Y < 9) - { - NPC.frame.Y = 9; - } - if (NPC.frame.Y > 14) - { - NPC.frame.Y = 14; - } - } - else - { - if (NPC.frame.Y >= 9) - { - NPC.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[Type].Value; - switch (CurrentVariant) - { - case (int)VariantType.Comet: - tex = cometTex.Value; - break; - case (int)VariantType.Oranda: - tex = orandaTex.Value; - break; - case (int)VariantType.BubbleEye: - tex = bubbleEyedTex.Value; - break; - } - float animSped = MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, -40, ShootTimer, true)); - Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.05f; - spriteBatch.Draw(tex, NPC.Center - screenPos, tex.Frame(1, 15, 0, NPC.frame.Y), NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 30), scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Lava, hit.HitDirection, -1f, 0, default, 1f); - } - string goreName = (VariantType)CurrentVariant switch - { - VariantType.Comet => "PodobooKoiComet", - VariantType.Oranda => "PodobooKoiOranda", - VariantType.BubbleEye => "PodobooKoiBubbleEyed", - _ => "PodobooKoi" - }; - CalamityUtils.SpawnGores(NPC, goreName, 2); - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - writer.WriteVector2(lavaLine); - writer.Write(NPC.Calamity().newAI[0]); - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - lavaLine = reader.ReadVector2(); - NPC.Calamity().newAI[0] = reader.ReadSingle(); - NPC.chaseable = reader.ReadBoolean(); - } - } -} diff --git a/NPCs/SunkenSea/PodobooKoi.png b/NPCs/SunkenSea/PodobooKoi.png deleted file mode 100644 index a917e63dc3..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoi.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png b/NPCs/SunkenSea/PodobooKoiBubbleEyed.png deleted file mode 100644 index ca341e7ea7..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoiComet.png b/NPCs/SunkenSea/PodobooKoiComet.png deleted file mode 100644 index 85350e418e..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoiComet.png and /dev/null differ diff --git a/NPCs/SunkenSea/PodobooKoiOranda.png b/NPCs/SunkenSea/PodobooKoiOranda.png deleted file mode 100644 index 1f11720fca..0000000000 Binary files a/NPCs/SunkenSea/PodobooKoiOranda.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs deleted file mode 100644 index 9827331ce7..0000000000 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ /dev/null @@ -1,507 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Potions; -using CalamityMod.Particles; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PolypPanasea : SunkenSeaNPC - { - public enum FishColor - { - Red = 0, - Turquoise = 1, - Green = 2, - Purple = 3, - Gold = 4, - Radiant = 5 - } - public enum PhaseType - { - Idle = 0, - Flee = 1, - Hiding = 2 - } - public ref float CurrentBehavior => ref NPC.ai[0]; - public ref float Variant => ref NPC.ai[1]; - public ref float PanaceaTimer => ref NPC.ai[2]; - - #region Textures - // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works - public static Asset RadiantTexture; - public static Asset GreenTexture; - public static Asset PurpleTexture; - public static Asset TurquoiseTexture; - public static Asset GoldTexture; - public static Asset TextureCoated; - public static Asset RadiantTextureCoated; - public static Asset GreenTextureCoated; - public static Asset PurpleTextureCoated; - public static Asset TurquoiseTextureCoated; - public static Asset GoldTextureCoated; - #endregion - - public int PolypIndex = -1; - - public Vector2 randomPathPoint; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 600; - public static int IdleMaxPathDistance = 1200; - - public static int FleeTileAnticipationDistance = 64; - - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void Load() - { - RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiant"); - GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGold"); - GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreen"); - PurpleTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurple"); - TurquoiseTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoise"); - TextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRedCoated"); - RadiantTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiantCoated"); - GoldTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGoldCoated"); - GreenTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreenCoated"); - PurpleTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurpleCoated"); - TurquoiseTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated"); - base.Load(); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.npcSlots = 0.1f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 36; - NPC.height = 22; - NPC.defense = 0; - NPC.lifeMax = 5; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.catchItem = (short)ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void OnSpawn(IEntitySource source) - { - // Panaseas released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - // Randomize the color of the fish - Variant = Main.rand.Next(0, 4); - // 1 in 30 chance for a rare fish variant (rfv) - if (Main.rand.NextBool(30)) - { - Variant = Main.rand.Next(4, 6); - } - // 1 in 5 chance for a Panasea to be coated - if (Main.rand.NextBool(5)) - { - PanaceaTimer = 61; - } - switch (Variant) - { - case (int)FishColor.Purple: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Green: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Turquoise: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Gold: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Radiant: - NPC.catchItem = ModContent.ItemType(); - break; - } - if (Variant == (int)FishColor.Gold || Variant == (int)FishColor.Radiant) - { - NPC.rarity = 3; - } - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PolypPanasea") - }); - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.5f; - MaxSpeed = 4f; - } - // Reset polyp index in case the polyp dies - if (PolypIndex > -1) - { - if (Main.npc[PolypIndex].type != ModContent.NPCType() || !Main.npc[PolypIndex].active || Main.npc[PolypIndex].life <= 0 || Main.npc[PolypIndex].Distance(NPC.Center) > 1000) - { - PolypIndex = -1; - } - } - if (NPC.wet) - { - switch (CurrentBehavior) - { - case (int)PhaseType.Idle: - IdleBehavior(); - break; - case (int)PhaseType.Flee: - FleeBehavior(); - break; - case (int)PhaseType.Hiding: - HideBehavior(); - break; - } - } - else - { - BeachedBehavior(); - } - - int dir = NPC.velocity.X.DirectionalSign(); - if (CurrentBehavior != (int)PhaseType.Hiding) - { - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - } - else - { - NPC.rotation = 0; - } - NPC.spriteDirection = NPC.direction = dir; - // Assure it cant be caught when collecting panacea - if (PanaceaTimer <= 60 && PanaceaTimer > 0) - { - PanaceaTimer--; - } - if (Variant == (int)FishColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - public void IdleBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(100, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - public void HideBehavior() - { - // Once the threat is gone or if the polyp is destroyed, go out of hiding - if (PolypIndex <= -1 || (CurrentPredator == null && Main.rand.NextBool(120))) - { - NPC.dontTakeDamage = false; - CurrentBehavior = (int)PhaseType.Idle; - pathfinding.ClearResults(); - return; - } - - // Become invincible while hiding - NPC.dontTakeDamage = true; - MaxSpeed = 2; - - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, Main.npc[PolypIndex].Center + Main.rand.NextVector2Unit() * Main.rand.Next(20, 30), SunkenSeaTileValidity)); - } - - public void FleeBehavior() - { - // If the predator is gone, go back to idling. - if (CurrentPredator == null && PolypIndex <= -1) - { - CurrentBehavior = (int)PhaseType.Idle; - MaxSpeed = 4; - return; - } - - MaxSpeed = 6; - - // If a polyp is found, try to run into it - if (PolypIndex > -1) - { - NPC.netUpdate = true; - Vector2 polypPos = Main.npc[PolypIndex].position; - pathfinding.DoPathfinding(new(this, NPC.Center, polypPos, SunkenSeaTileValidity)); - - if (NPC.Distance(Main.npc[PolypIndex].Center) < 50) - { - CurrentBehavior = (int)PhaseType.Hiding; - pathfinding.ClearResults(); - } - } - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - else if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - - public void BeachedBehavior() - { - if (NPC.velocity.Y == 0f) - { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) - { - NPC.velocity.X = 0f; - } - } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) - { - NPC.velocity.Y = 10f; - } - NPC.ai[0] = 1f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPredator && Vector2.DistanceSquared(NPC.Center, n.Center) < 1960f * 1960f; - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - protected override void OnPredatorDetection(NPC predator) - { - if (CurrentBehavior == (int)PhaseType.Idle) - { - pathfinding?.ClearResults(); - CurrentBehavior = (int)PhaseType.Flee; - AlertPolyp(); - } - } - - public void AlertPolyp() - { - // Look for a nearby polyp to hide in - if (PolypIndex <= -1) - { - foreach (NPC n in Main.ActiveNPCs) - { - bool nCloser = PolypIndex <= -1 ? true : n.Distance(NPC.Center) < Main.npc[PolypIndex].Distance(NPC.Center); - if (n.type == ModContent.NPCType() && nCloser) - { - PolypIndex = n.whoAmI; - } - } - } - // If a polyp is found, cause both NPCs to signal each other with a ! - if (PolypIndex > -1) - { - SoundEngine.PlaySound(SoundID.NPCHit37 with { Pitch = 1 }, NPC.Center); - - if (!Main.dedServ) - { - var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Red, - Main.rand.Next(30, 46), - EmoteExpressionParticle.EmoteType.Exclamation); - GeneralParticleHandler.SpawnParticle(emote); - Particle emote2 = new EmoteExpressionParticle( - Main.npc[PolypIndex].Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Yellow, - Main.rand.Next(30, 46), - EmoteExpressionParticle.EmoteType.Exclamation); - GeneralParticleHandler.SpawnParticle(emote2); - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (Variant == (int)FishColor.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPolypPanasea"); - } - if (Variant == (int)FishColor.Gold) - { - typeName = CalamityUtils.GetTextValue("NPCs.GoldPolypPanasea"); - } - } - - public override void FindFrame(int frameHeight) - { - if (!NPC.wet && !NPC.IsABestiaryIconDummy) - { - NPC.frameCounter = 0.0; - return; - } - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - NPC.ai[3] = frame; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.8f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (Variant < (int)FishColor.Gold) - { - string goreName = Variant switch - { - (int)FishColor.Turquoise => "PolypPanaseaTurquoise", - (int)FishColor.Purple => "PolypPanaseaPurple", - (int)FishColor.Green => "PolypPanaseaGreen", - _ => "PolypPanaseaRed", - }; - CalamityUtils.SpawnGores(NPC, goreName, 2); - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - bool Coated = PanaceaTimer >= 61; - - Texture2D texture = TextureAssets.Npc[Type].Value; - switch (Variant) - { - case (int)FishColor.Radiant: - texture = Coated ? RadiantTextureCoated.Value : RadiantTexture.Value; - break; - case (int)FishColor.Gold: - texture = Coated ? GoldTextureCoated.Value : GoldTexture.Value; - break; - case (int)FishColor.Purple: - texture = Coated ? PurpleTextureCoated.Value : PurpleTexture.Value; - break; - case (int)FishColor.Green: - texture = Coated ? GreenTextureCoated.Value : GreenTexture.Value; - break; - case (int)FishColor.Turquoise: - texture = Coated ? TurquoiseTextureCoated.Value : TurquoiseTexture.Value; - break; - case (int)FishColor.Red: - texture = Coated ? TextureCoated.Value : TextureAssets.Npc[Type].Value; - break; - } - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[Type] / 2)); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Rectangle frame = texture.Frame(1, 6, 0, (int)NPC.ai[3]); - spriteBatch.Draw(texture, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - public override bool? CanBeCaughtBy(Item item, Player player) - { - if (PanaceaTimer > 0) - { - if (PanaceaTimer > 60) - { - Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ModContent.ItemType()); - PanaceaTimer = 60; - } - return false; - } - return null; - } - public override bool CanBeHitByNPC(NPC attacker) - { - if (attacker.type == ModContent.NPCType() || attacker.type == ModContent.NPCType()) - return false; - return PredatorIDs.Contains(attacker.type); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - writer.Write(PolypIndex); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - PolypIndex = reader.ReadInt32(); - } - } -} diff --git a/NPCs/SunkenSea/PolypPanasea.png b/NPCs/SunkenSea/PolypPanasea.png deleted file mode 100644 index 08ba323d31..0000000000 Binary files a/NPCs/SunkenSea/PolypPanasea.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGold.png b/NPCs/SunkenSea/PolypPanaseaGold.png deleted file mode 100644 index a48da65906..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGoldCoated.png b/NPCs/SunkenSea/PolypPanaseaGoldCoated.png deleted file mode 100644 index 47dddda974..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGoldCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreen.png b/NPCs/SunkenSea/PolypPanaseaGreen.png deleted file mode 100644 index 7bd323fb82..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png deleted file mode 100644 index 1f46bf5148..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurple.png b/NPCs/SunkenSea/PolypPanaseaPurple.png deleted file mode 100644 index 3871e4e412..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaPurple.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png deleted file mode 100644 index 6d9f423150..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiant.png b/NPCs/SunkenSea/PolypPanaseaRadiant.png deleted file mode 100644 index 2099da1dfb..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png b/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png deleted file mode 100644 index 74c021ef11..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaRedCoated.png b/NPCs/SunkenSea/PolypPanaseaRedCoated.png deleted file mode 100644 index bfbf7ba316..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaRedCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoise.png b/NPCs/SunkenSea/PolypPanaseaTurquoise.png deleted file mode 100644 index e45b512f09..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaTurquoise.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png deleted file mode 100644 index 3d4c9475f8..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/Polyperil.cs b/NPCs/SunkenSea/Polyperil.cs deleted file mode 100644 index c2b9208795..0000000000 --- a/NPCs/SunkenSea/Polyperil.cs +++ /dev/null @@ -1,210 +0,0 @@ -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Polyperil : SunkenSeaNPC - { - public ref float Color => ref NPC.ai[1]; - - public ref float Timer => ref NPC.ai[0]; - - public static Asset blueTexture = null; - - public static Asset greenTexture = null; - - public static Asset pinkTexture = null; - - public static Asset voltaicTexture = null; - - // The tentacles do all the work - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.PolypForest; - - public override void Load() - { - pinkTexture = ModContent.Request(Texture + "Pink"); - blueTexture = ModContent.Request(Texture + "Blue"); - greenTexture = ModContent.Request(Texture + "Green"); - voltaicTexture = ModContent.Request(Texture + "Voltaic"); - } - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - - NPC.damage = 20; - NPC.lifeMax = 200; - NPC.defense = 10; - NPC.knockBackResist = 0f; - NPC.chaseable = false; - - NPC.aiStyle = -1; - AIType = -1; - NPC.width = 32; - NPC.height = 36; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(silver: 5); - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.chaseable = reader.ReadBoolean(); - } - - public override void OnSpawn(IEntitySource source) - { - // Pick a random color - Color = Main.rand.Next(0, 3); - // 1 in 15 chance to be Voltaic - if (Main.rand.NextBool(15)) - Color = 3; - - // Spawn tentacles - int dist = 80; - int tentMin = 3; - int tentMax = 8; - for (int i = 0; i < Main.rand.Next(tentMin, tentMax + 1); i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 pos = NPC.Center + new Vector2(Main.rand.Next(-dist, dist), 20); - NPC tent = NPC.NewNPCDirect(NPC.GetSource_FromThis(), NPC.Center, ModContent.NPCType(), ai0: NPC.whoAmI); - tent.ModNPC().anchor = pos; - } - } - } - - public override void AI() - { - Timer++; - NPC.velocity.Y += 10; - - // While out of water, slowly lose health (suffocating) - if (!NPC.wet) - { - if (Timer % 60 == 0) - { - NPC.HitEffect(0, 5); - NPC.life -= 5; - if (NPC.life <= 0) - NPC.life = 1; - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - } - if (Color < 3) - { - string goreName = Color switch - { - 1 => "PolyperilBlue", - 2 => "PolyperilGreen", - _ => "PolyperilPink" - }; - CalamityUtils.SpawnGores(NPC, goreName, 1); - } - } - - public override bool CanBeHitByNPC(NPC attacker) - { - return PredatorIDs.Contains(attacker.type); - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - NPC.chaseable = true; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - - else if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; - } - return 0f; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = Color switch - { - 1 => blueTexture.Value, - 2 => greenTexture.Value, - 3 => voltaicTexture.Value, - _ => pinkTexture.Value - }; - - spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - screenPos, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, NPC.scale, SpriteEffects.None, 0); - - // Desaturate in color when losing health, based on real anemones - float vibrance = MathHelper.Lerp(1, 0, Utils.GetLerpValue(1, 0.33f, NPC.life / (float)NPC.lifeMax, true)); - - spriteBatch.Draw(tex, NPC.Center - screenPos, null, NPC.GetAlpha(drawColor) * vibrance, NPC.rotation, tex.Size() / 2, NPC.scale, SpriteEffects.None, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Polyperil.png b/NPCs/SunkenSea/Polyperil.png deleted file mode 100644 index 5cec975ef0..0000000000 Binary files a/NPCs/SunkenSea/Polyperil.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilBlue.png b/NPCs/SunkenSea/PolyperilBlue.png deleted file mode 100644 index 4f91afe357..0000000000 Binary files a/NPCs/SunkenSea/PolyperilBlue.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilGreen.png b/NPCs/SunkenSea/PolyperilGreen.png deleted file mode 100644 index 74a51dcf1c..0000000000 Binary files a/NPCs/SunkenSea/PolyperilGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilPink.png b/NPCs/SunkenSea/PolyperilPink.png deleted file mode 100644 index 9c9747e5dd..0000000000 Binary files a/NPCs/SunkenSea/PolyperilPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilTentacle.cs b/NPCs/SunkenSea/PolyperilTentacle.cs deleted file mode 100644 index b1c2b87f05..0000000000 --- a/NPCs/SunkenSea/PolyperilTentacle.cs +++ /dev/null @@ -1,282 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PolyperilTentacle : SunkenSeaNPC - { - public ref float ParentIndex => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - public List Segments; - - // Where the tentacle will hover when not attacking - public Vector2 anchor; - - // They attack everything - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List(); - - // Tentacles are not a natural enemy, they are manually spawned by Polyperils - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.None; - - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Polyperil.DisplayName"); - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - - NPC.npcSlots = 0f; - NPC.damage = 20; - NPC.lifeMax = 200; - NPC.defense = 0; - NPC.knockBackResist = 0f; - NPC.chaseable = false; - NPC.dontTakeDamage = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - - NPC.aiStyle = -1; - AIType = -1; - NPC.width = 20; - NPC.height = 20; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - // Banner = NPC.type; - // BannerItem = ModContent.ItemType(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(anchor.X); - writer.Write(anchor.Y); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - anchor = new Vector2(reader.ReadSingle(), reader.ReadSingle()); - } - - public override void AI() - { - NPC parent = Main.npc[(int)ParentIndex]; - if (parent == null || !parent.active || parent.life < 0 || parent.type != ModContent.NPCType()) - { - NPC.active = false; - return; - } - - // Create a chain - if (Segments == null || Segments.Count < 10) - { - Segments = new List(10); - for (int i = 0; i < 10; i++) - { - VerletSimulatedSegment segment = new VerletSimulatedSegment(parent.Center + Vector2.UnitY * i * 10); - Segments.Add(segment); - } - - Segments[0].locked = true; - Segments[^1].locked = true; - } - Entity targ = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - // While aggro'd, launch at the target then retreat - if (targ != null) - { - // Remain stationary while at rest - if (Timer < 0) - { - NPC.velocity = Vector2.Zero; - } - // Launch - if (Timer == 0) - { - NPC.velocity = NPC.SafeDirectionTo(targ.Center) * 8; - SoundEngine.PlaySound(SoundID.Item152 with { Volume = 1.5f, Pitch = 0.4f }, NPC.Center); - } - // Retreat - if (Timer > 20) - { - NPC.velocity = NPC.SafeDirectionTo(anchor) * 5; - if (Timer == 21) - { - RecalculatePosition(parent.Center); - } - } - // Reset timer - if (Timer > 30 && NPC.Distance(anchor) < 20) - { - NPC.velocity = Vector2.Zero; - Timer = -120; - } - } - // Otherwise hover around the anchor position - else - { - NPC.velocity = NPC.SafeDirectionTo(anchor) * 3; - // Randomly relocate position - if (Timer > 300 && Main.rand.NextBool(180)) - { - RecalculatePosition(parent.Center); - Timer = 0; - } - } - // If the anchor is too far from the parent (usually happens if the parent is moved) recalculate the anchor position - if (anchor.Distance(parent.Center) > 200) - { - RecalculatePosition(parent.Center); - } - - // Repel other tentacles - float SAImovement = 0.05f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherTentacle = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherTentacle.active || k == NPC.whoAmI || (otherTentacle.type != ModContent.NPCType())) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherTentacle.position.X) + Math.Abs(NPC.position.Y - otherTentacle.position.Y); - if (taxicabDist < NPC.width * 1.5f) - { - if (NPC.position.X < otherTentacle.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherTentacle.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - NPC.rotation = NPC.DirectionTo(parent.Center).ToRotation(); - - // Update the chain - Segments[0].oldPosition = Segments[0].position; - Segments[0].position = parent.Center; - - Segments[^1].oldPosition = Segments[^1].position; - Segments[^1].position = parent.active ? NPC.Center : parent.Center; - - Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 5, loops: 1, gravity: 0.3f); - - NPC.netUpdate = true; - NPC.netSpam = 0; - - Timer++; - } - - public void RecalculatePosition(Vector2 basePos, int dist = 50) - { - anchor = basePos + new Vector2(Main.rand.Next(-dist, dist), Main.rand.Next(-dist, dist)); - } - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 460f * 460f; - } - - protected override bool NPCSearchFilter(NPC n) - { - // The tentacles go after EVERYTHING - return (Vector2.DistanceSquared(NPC.Center, n.Center) < 660f * 660f && n.type != NPC.type && n.type != ModContent.NPCType() && n.type != ModContent.NPCType()); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // Kelpie Seadragons have high resistance to Polyperils as they eat them - if (target.type == ModContent.NPCType()) - { - modifiers.SourceDamage *= 0.05f; - } - } - - public override void ModifyTypeName(ref string typeName) - { - NPC parent = Main.npc[(int)ParentIndex]; - if (parent == null || !parent.active || parent.life < 0 || parent.type != ModContent.NPCType()) - { - return; - } - if (parent.ai[1] == 3) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPolyperil"); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - NPC parent = Main.npc[(int)ParentIndex]; - if (parent == null || !parent.active || parent.life < 0 || parent.type != ModContent.NPCType()) - { - return false; - } - - // Color is based on parent color - Color col = parent.ai[1] switch - { - 1 => new Color(27, 190, 255), - 2 => new Color(7, 255, 180), - 3 => new Color(122, 255, 240), - _ => new Color(255, 140, 248) - }; - - // Desaturate as parent's health lowers - float vibrance = MathHelper.Lerp(1, 0, Utils.GetLerpValue(1, 0.33f, parent.life / (float)parent.lifeMax, true)); - Color final = Color.Lerp(Color.White, col, vibrance); - - Texture2D tex = TextureAssets.Npc[Type].Value; - Rectangle tip = new Rectangle(0, 0, 8, 10); - Rectangle chain = new Rectangle(0, 12, 8, 8); - - if (Segments == null || Segments.Count <= 0) - { - spriteBatch.Draw(tex, NPC.Center - screenPos, tip, drawColor.MultiplyRGB(final), NPC.rotation, new Vector2(4, 10), NPC.scale, SpriteEffects.None, 0); - return false; - } - - // Draw tentacle chains - for (int i = 0; i < Segments.Count - 1; i++) - { - VerletSimulatedSegment seg = Segments[i]; - float dist = i > 0 ? Vector2.Distance(seg.position, Segments[i - 1].position) : 0; - if (dist <= 2) - dist = 2; - dist += 4; - if (i == Segments.Count - 1) - { - dist = Vector2.Distance(seg.position, parent.Center) + 2; - } - float rot = 0f; - if (i > 0) - rot = seg.position.DirectionTo(Segments[i - 1].position).ToRotation(); - SpriteEffects dir = NPC.Center.X > parent.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; - spriteBatch.Draw(tex, seg.position - screenPos, chain, drawColor.MultiplyRGB(final), rot + MathHelper.PiOver2, new Vector2(4, 4), new Vector2(1, dist / 8), dir, 0); - } - - // Draw the tip - spriteBatch.Draw(tex, NPC.Center - screenPos, tip, drawColor.MultiplyRGB(final), NPC.rotation - MathHelper.PiOver2, new Vector2(4, 5), NPC.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/NPCs/SunkenSea/PolyperilTentacle.png b/NPCs/SunkenSea/PolyperilTentacle.png deleted file mode 100644 index b6795c38e8..0000000000 Binary files a/NPCs/SunkenSea/PolyperilTentacle.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilVoltaic.png b/NPCs/SunkenSea/PolyperilVoltaic.png deleted file mode 100644 index 184d259a00..0000000000 Binary files a/NPCs/SunkenSea/PolyperilVoltaic.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index dfb0d550fc..7a077f0067 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -1,18 +1,16 @@ using System; -using System.Collections.Generic; using System.IO; -using CalamityMod.Enums; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles.SunkenSea; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -21,53 +19,36 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class PrismBack : SunkenSeaNPC + public class PrismBack : ModNPC { public static Asset GlowTexture; - public ref float BiteCount => ref NPC.ai[0]; - public ref float ShardCooldown => ref NPC.ai[1]; - - /// - /// The horizontal coordinate of a located crystal - /// - public ref float TileX => ref NPC.ai[2]; - - /// - /// The vertical coordinate of a located crystal - /// - public ref float TileY => ref NPC.ai[3]; - - public Vector2 tilePosition => new Vector2(TileX, TileY); - protected override List PreyIDs => []; - protected override List PredatorIDs => []; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - - public override void Load() => GlowTexture = ModContent.Request(Texture + "Glow"); public override void SetStaticDefaults() { - //Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0 }; value.Position.X += 15; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - base.SetStaticDefaults(); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() { - base.SetDefaults(); NPC.noGravity = true; - NPC.damage = 20; - NPC.width = 88; - NPC.height = 66; - NPC.defense = 15; - NPC.lifeMax = 500; + NPC.damage = Main.hardMode ? 40 : 20; + NPC.width = 72; + NPC.height = 58; + NPC.defense = Main.hardMode ? 25 : 15; + NPC.lifeMax = Main.hardMode ? 1000 : 500; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(silver: 2); + NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit24; NPC.DeathSound = SoundID.NPCDeath27; NPC.knockBackResist = 0.15f; @@ -78,6 +59,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -92,6 +74,7 @@ namespace CalamityMod.NPCs.SunkenSea { writer.Write(NPC.chaseable); } + public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); @@ -99,102 +82,73 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - if (pathfinding == null) + if ((NPC.Center.Y + 10f) > Main.player[NPC.target].Center.Y) { - pathfinding = new PathfindingManager(this); - MaxSpeed = 1.8f; - } - - NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); - - if (ShardCooldown > 0) - ShardCooldown--; - - Tile t = CalamityUtils.ParanoidTileRetrieval((int)(TileX / 16), (int)(TileY / 16)); - - // TODO - // Change this to kelp when it's added - int tileType = ModContent.TileType(); - - // Assure the kelp still exists, if it's gone, clear the tile - if ((TileX != 0 || TileY != 0) && t.TileType != tileType) - { - TileX = 0; - TileY = 0; - } - - if (NPC.wet) - { - NPC.noGravity = true; - Vector2? tilePos = tilePosition; - // Find kelp - if (Main.rand.NextBool(300)) + if (CalamityWorld.death) { - if (tilePos == null || tilePos == Vector2.Zero) - { - tilePos = CalamityUtils.NPCTileDetection(NPC, tileType, 300, true); - } + NPC.damage = NPC.defDamage * 3; } - - bool eatBehaviour = false; - // Go to the kelp if one exists nearby - if (tilePos != null && tilePos != Vector2.Zero) + else if (CalamityWorld.revenge) { - TileX = tilePos.Value.X; - TileY = tilePos.Value.Y; - t = CalamityUtils.ParanoidTileRetrieval((int)(TileX / 16), (int)(TileY / 16)); - if (t.TileType == tileType) - { - eatBehaviour = true; - // Go to the vine if not far enough - if (tilePos.Value.Distance(NPC.Center) > 40 && BiteCount == 0) - { - pathfinding.DoPathfinding(new(this, NPC.Center, tilePos.Value, SunkenSeaTileValidity)); - } - // Slow down and eat the kelp - else - { - pathfinding.ClearResults(); - NPC.velocity *= 0.97f; - // Play a crunch sound and spawn some grass dust randomly - if (Main.rand.NextBool(50)) - { - SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = -0.4f }, NPC.Center); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); - } - BiteCount++; - } - // After munching 5 times, the vine is broken and the turtle continues about its day - if (BiteCount == 5) - { - WorldGen.KillTile((int)TileX / 16, (int)TileY / 16); - TileX = 0; - TileY = 0; - BiteCount = 0; - NPC.netUpdate = true; - } - } - } + NPC.damage = (int)Math.Round(NPC.defDamage * 2.75); } - // Just wander about if it's not trying to eat - else if (!eatBehaviour) + else if (Main.expertMode) { - TileX = 0; - TileY = 0; - BiteCount = 0; - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(200f, 800f), SunkenSeaTileValidity)); + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); + } + else + { + NPC.damage = (int)Math.Round(NPC.defDamage * 1.25); } } else { - NPC.noGravity = false; + if (CalamityWorld.death) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 2.5); + } + else if (CalamityWorld.revenge) + { + NPC.damage = (int)Math.Round(NPC.defDamage * 2.25); + } + else if (Main.expertMode) + { + NPC.damage = NPC.defDamage * 2; + } + else + { + NPC.damage = NPC.defDamage; + } } + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 2, 0f, 0f, 0f, 0f, 0f, 0.1f); + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.1f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } - public override bool CanBeHitByNPC(NPC attacker) => false; public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) @@ -203,35 +157,12 @@ namespace CalamityMod.NPCs.SunkenSea } return null; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - if ((NPC.Center.Y + 10f) > target.Center.Y) - modifiers.SourceDamage *= CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2.75f : Main.expertMode ? 2.5f : 1.25f; - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) => SpawnShards(player); - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) => SpawnShards(projectile); - private void SpawnShards(Entity e) - { - if (ShardCooldown > 0) - return; - - ShardCooldown = 20; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 3; i++) - { - Vector2 shardVel = new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(1.25f) * -1); - Projectile.NewProjectile(NPC.GetSource_OnHurt(e), NPC.Center + Vector2.UnitX * Main.rand.NextFloat(-20f, 20f), shardVel, ModContent.ProjectileType(), 10, 0f, Main.myPlayer, Main.rand.Next(3), NPC.whoAmI); - } - } - } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if ((spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.7f; + return SpawnCondition.CaveJellyfish.Chance * 0.9f; } return 0f; } @@ -250,28 +181,19 @@ namespace CalamityMod.NPCs.SunkenSea } if (NPC.life <= 0) { + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore4").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismBackGore5").Type, 1f); + } for (int k = 0; k < 25; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } } - CalamityUtils.SpawnGores(NPC, "Prismback", 3); - } - - /*public override void FindFrame(int frameHeight) - { - NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.1f : 0f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; - }*/ - - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Rectangle frame = GlowTexture.Value.Frame(1, Main.npcFrameCount[Type], 0, NPC.frame.Y); - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Blue); - Main.spriteBatch.Draw(GlowTexture.Value, NPC.Center - screenPos, null, color, NPC.rotation, frame.Size() / 2f, 1f, spriteEffects, 0f); } } } diff --git a/NPCs/SunkenSea/PrismBack.png b/NPCs/SunkenSea/PrismBack.png index 80e7d02a14..e0b6fe8eb9 100644 Binary files a/NPCs/SunkenSea/PrismBack.png and b/NPCs/SunkenSea/PrismBack.png differ diff --git a/NPCs/SunkenSea/PrismBackGlow.png b/NPCs/SunkenSea/PrismBackGlow.png index 544f81f34b..55328bedde 100644 Binary files a/NPCs/SunkenSea/PrismBackGlow.png and b/NPCs/SunkenSea/PrismBackGlow.png differ diff --git a/NPCs/SunkenSea/PrismaticGuppy.cs b/NPCs/SunkenSea/PrismaticGuppy.cs deleted file mode 100644 index 1d28a5484f..0000000000 --- a/NPCs/SunkenSea/PrismaticGuppy.cs +++ /dev/null @@ -1,737 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Tiles.SunkenSea; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class PrismaticGuppy : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Pawn = 1, - Fleeing = 2, - Hiding = 3 - } - - public enum FishColor - { - Blue = 0, - Green = 1, - Pink = 2, - Gold = 3, - Radiant = 4 - } - - // I do not know what to call the variants, so I'm going on intuition - public enum FishShape - { - Normal = 0, - Cube = 1, - Angel = 2 - } - - /// - /// AI State - /// - public ref float CurrentPhase => ref NPC.ai[0]; - - /// - /// The color to use - /// - public ref float CurrentColor => ref NPC.ai[1]; - - /// - /// The shape to use - /// - public ref float CurrentShape => ref NPC.ai[2]; - - /// - /// The fish's role - /// - public ref float Role => ref NPC.ai[3]; - - /// - /// The index of the guppy that this guppy should follow - /// - public ref float OwnerIndex => ref NPC.localAI[0]; - - /// - /// Timer for handling when the guppy goes out of hiding - /// - public ref float HideTimer => ref NPC.localAI[1]; - - /// - /// The horizontal coordinate of a located crystal - /// - public ref float TileX => ref NPC.localAI[2]; - - /// - /// The vertical coordinate of a located crystal - /// - public ref float TileY => ref NPC.localAI[3]; - - public Vector2 tilePosition => new Vector2(TileX, TileY); - - // Each shape has a different frame count - public int FrameCount => CurrentShape == (int)FishShape.Angel ? 5 : CurrentShape == (int)FishShape.Cube ? 4 : 6; - - public Entity avoidedEntity; - - public Vector2 randomPathPoint; - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 600; - public static int IdleMaxPathDistance = 1000; - - public static int FleeTileAnticipationDistance = 64; - - #region Textures - // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works - public static Asset RadiantTexture; - public static Asset GreenTexture; - public static Asset PinkTexture; - public static Asset GoldTexture; - - public static Asset Texture2; - public static Asset RadiantTexture2; - public static Asset GreenTexture2; - public static Asset PinkTexture2; - public static Asset GoldTexture2; - - public static Asset Texture3; - public static Asset RadiantTexture3; - public static Asset GreenTexture3; - public static Asset PinkTexture3; - public static Asset GoldTexture3; - #endregion - - protected override List PreyIDs => new List() - { - ModContent.NPCType() - }; - - protected override List PredatorIDs => new List() { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - - public override void Load() - { - RadiantTexture = ModContent.Request(Texture + "Radiant"); - GoldTexture = ModContent.Request(Texture + "Gold"); - GreenTexture = ModContent.Request(Texture + "Green"); - PinkTexture = ModContent.Request(Texture + "Pink"); - - Texture2 = ModContent.Request(Texture + "2"); - RadiantTexture2 = ModContent.Request(Texture + "Radiant2"); - GoldTexture2 = ModContent.Request(Texture + "Gold2"); - GreenTexture2 = ModContent.Request(Texture + "Green2"); - PinkTexture2 = ModContent.Request(Texture + "Pink2"); - - Texture3 = ModContent.Request(Texture + "3"); - RadiantTexture3 = ModContent.Request(Texture + "Radiant3"); - GoldTexture3 = ModContent.Request(Texture + "Gold3"); - GreenTexture3 = ModContent.Request(Texture + "Green3"); - PinkTexture3 = ModContent.Request(Texture + "Pink3"); - - base.Load(); - } - - public override void SetStaticDefaults() - { - // This is technically redundant as variants handle this - Main.npcFrameCount[Type] = 6; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.npcSlots = 0f; - NPC.noGravity = true; - NPC.damage = 0; - NPC.width = 28; - NPC.height = 28; - NPC.defense = 0; - NPC.lifeMax = 5; - NPC.aiStyle = -1; - AIType = -1; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.catchItem = (short)ModContent.ItemType(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PrismaticGuppy") - }); - } - - public override void OnSpawn(IEntitySource source) - { - NPC.frameCounter = Main.rand.NextFloat(FrameCount); - CurrentShape = Main.rand.Next(0, 3); - // Guppies released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - return; - } - // Red/Green in reefs, Green/Blue elsewhere - if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - { - CurrentColor = Main.rand.Next(1, 3); - } - else - { - CurrentColor = Main.rand.Next(0, 2); - } - NPC.TargetClosest(); - // 1 in 30 chance for a rare fish variant (rfv) - if (Main.rand.NextBool(30)) - { - CurrentColor = Main.rand.Next(3, 5); - NPC.rarity = 3; - } - // Decide item.......................... - switch (CurrentColor) - { - case (int)FishColor.Pink: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Green: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Blue: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Gold: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)FishColor.Radiant: - NPC.catchItem = ModContent.ItemType(); - break; - } - } - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.5f; - MaxSpeed = 4f; - } - // Spawn more guppies if a leader/naturally spawned guppy - if (Role == 0 && NPC.releaseOwner == 255) - { - Role = 2; - NPC.TargetClosest(false); - // Spawn a shoal of guppies - int fishCount = Main.rand.Next(2, 4); - // More spawn in the Gleaming Burrows/Clam Den - if (NPC.HasPlayerTarget) - { - if (Main.player[NPC.target].Calamity().ZoneGleamingBurrows || Main.player[NPC.target].Calamity().ZoneClamDen) - fishCount += 5; - } - for (int i = 0; i < fishCount; i++) - { - int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, Type); - Main.npc[n].ai[0] = (int)PhaseType.Pawn; - Main.npc[n].ai[3] = 1; // mark this guppy as a pawn - Main.npc[n].localAI[0] = NPC.whoAmI; // makes the spawned guppy recognize this one as the alpha - Main.npc[n].netUpdate = true; - } - } - NPC owner = Main.npc[(int)OwnerIndex]; - if (NPC.wet) - { - switch (CurrentPhase) - { - // Just do generic pathfinding if a leader. Target prey if one exists - case (int)PhaseType.Idle: - { - Acceleration = 0.5f; - MaxSpeed = 4; - if (CurrentPrey is not null) - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity)); - else - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - break; - // The unenlightened masses, They cannot make the judgement call - case (int)PhaseType.Pawn: - { - if (owner == null || !owner.active || owner.type != ModContent.NPCType()) - { - CurrentPhase = (int)PhaseType.Idle; - Role = 2; - break; - } - - if (!owner.active) - return; - - if (NPC.Distance(owner.Center) > 20) - pathfinding.DoPathfinding(new(this, NPC.Center, owner.Center, SunkenSeaTileValidity)); - else - { - float passiveMvtFloat = 0.5f; - float range = 70f; - Vector2 fischPos = NPC.Center; - float xDist = owner.Center.X - fischPos.X; - float yDist = owner.Center.Y - fischPos.Y; - yDist += Main.rand.NextFloat(-10, 20); - xDist += Main.rand.NextFloat(-10, 20); - xDist += 20f * -(float)owner.direction; - Vector2 leaderVector = new Vector2(xDist, yDist); - float leaderDist = leaderVector.Length(); - float returnSpeed = 8f; - //If leader is close enough, resume normal - if (leaderDist < range && owner.velocity.Y == 0f && - NPC.Bottom.Y <= owner.Bottom.Y && - !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) - { - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - } - - if (leaderDist < 50f) - { - if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) - { - NPC.velocity *= 0.99f; - } - passiveMvtFloat = 0.01f; - } - else - { - if (leaderDist < 100f) - { - passiveMvtFloat = 0.1f; - } - if (leaderDist > 300f) - { - passiveMvtFloat = 1f; - } - leaderDist = returnSpeed / leaderDist; - leaderVector.X *= leaderDist; - leaderVector.Y *= leaderDist; - } - if (NPC.velocity.X < leaderVector.X) - { - NPC.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) - { - NPC.velocity.X += passiveMvtFloat; - } - } - if (NPC.velocity.X > leaderVector.X) - { - NPC.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) - { - NPC.velocity.X -= passiveMvtFloat; - } - } - if (NPC.velocity.Y < leaderVector.Y) - { - NPC.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) - { - NPC.velocity.Y += passiveMvtFloat * 2f; - } - } - if (NPC.velocity.Y > leaderVector.Y) - { - NPC.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) - { - NPC.velocity.Y -= passiveMvtFloat * 2f; - } - } - if (NPC.velocity.X >= 0.25f) - { - NPC.direction = -1; - } - else if (NPC.velocity.X < -0.25f) - { - NPC.direction = 1; - } - NPC.spriteDirection = -NPC.direction; - } - - float SAImovement = 0.2f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || otherFish.type != ModContent.NPCType()) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; - } - } - } - break; - // Run from predators, attempting to find crystals to camo in - case (int)PhaseType.Fleeing: - { - if (CurrentPredator is not null) - { - Acceleration = 0.6f; - MaxSpeed = 6; - Vector2? tilePos = tilePosition; - - // Find a sea prism - if (tilePos == null || tilePos == Vector2.Zero) - { - tilePos = CalamityUtils.NPCTileDetection(NPC, ModContent.TileType(), 300); - } - - // Go to a Prism Shard if one exists nearby - if (tilePos != null && tilePos != Vector2.Zero) - { - TileX = tilePos.Value.X; - TileY = tilePos.Value.Y; - pathfinding.DoPathfinding(new(this, NPC.Center, tilePos.Value, SunkenSeaTileValiditySizeless)); - if (NPC.Distance(tilePos.Value) < 16) - { - CurrentPhase = (int)PhaseType.Hiding; - NPC.netUpdate = true; - break; - } - } - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - else if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * 96).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - else - { - CurrentPhase = (int)PhaseType.Idle; - } - } - break; - // Hide - case (int)PhaseType.Hiding: - { - // Stay still - NPC.rotation = Utils.AngleLerp(NPC.rotation, 0, 0.05f); - NPC.velocity *= 0.95f; - Tile t = CalamityUtils.ParanoidTileRetrieval((int)(TileX / 16), (int)(TileY / 16)); - - // Assure the prism still exists, if the player breaks it, the disguise is gone - if (t.TileType != ModContent.TileType()) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.netUpdate = true; - break; - } - - // Once the coast is clear, wait 2 seconds then go out - if (CurrentPredator is null) - { - HideTimer--; - if (HideTimer <= 0) - { - CurrentPhase = (int)PhaseType.Idle; - NPC.netUpdate = true; - } - } - // Face towards the predator and set the safety timer to 2 seconds - else - { - NPC.direction = NPC.DirectionTo(CurrentPredator.Center).X.DirectionalSign(); - HideTimer = 120; - } - } - break; - } - - NPC.dontTakeDamage = NPC.alpha > 0; - - int dir = NPC.velocity.X.DirectionalSign(); - // Become transparent while hiding and opaque otherwise - if (CurrentPhase != (int)PhaseType.Hiding) - { - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - if (NPC.alpha > 0) - { - NPC.alpha -= 40; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - } - else - { - if (NPC.alpha < 150) - { - NPC.alpha += 10; - } - } - NPC.spriteDirection = NPC.direction = dir; - } - else - { - if (NPC.velocity.Y < 12) - NPC.velocity.Y += 1; - } - - if (Main.rand.NextBool(50)) - { - int dustid = DustID.WhiteTorch; - switch (CurrentColor) - { - case 0: - dustid = DustID.IceTorch; - break; - case 1: - dustid = DustID.CoralTorch; - break; - case 2: - dustid = DustID.PinkTorch; - break; - case 4: - dustid = DustID.BoneTorch; - break; - } - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); - dust.velocity = Vector2.Zero; - dust.noGravity = true; - dust.color *= 0.5f; - dust.noLight = true; - } - - Color c = Color.White; - - switch (CurrentColor) - { - case 0: - c = Color.SkyBlue; - break; - case 1: - c = Color.SeaGreen; - break; - case 2: - c = Color.Pink; - break; - case 4: - c = Color.Cyan; - break; - } - Lighting.AddLight(NPC.Center, c.R / 255f, c.G / 255f, c.B / 255f); - - if (CurrentColor == (int)FishColor.Gold) - { - NPC.ProduceGoldCritterDust(); - } - } - - protected override void OnPredatorDetection(NPC predator) - { - // Don't reset the flee state while hiding - if (CurrentPhase != (int)PhaseType.Hiding) - CurrentPhase = (int)PhaseType.Fleeing; - } - - // Item sprite based on fish - public override void OnCaughtBy(Player player, Item item, bool failed) - { - if (item.ModItem != null) - { - if (item.ModItem is PrismaticGuppyItem gup) - { - if (CurrentShape == (int)FishShape.Cube) - gup.shapeVariant = 1; - - if (CurrentShape == (int)FishShape.Angel) - gup.shapeVariant = 2; - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (CurrentColor == (int)FishColor.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPrismaticGuppy"); - } - if (CurrentColor == (int)FishColor.Gold) - { - typeName = CalamityUtils.GetTextValue("NPCs.GoldPrismaticGuppy"); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) - return SpawnCondition.CaveJellyfish.Chance * 0.2f; - if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.1f; - } - return 0f; - } - - public override void FindFrame(int frameHeight) - { - if ((!NPC.wet && !NPC.IsABestiaryIconDummy) || CurrentPhase == (int)PhaseType.Hiding) - { - NPC.frameCounter = 0.0; - return; - } - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y++; - NPC.frameCounter = 0; - } - if (NPC.frame.Y >= FrameCount - 1) - { - NPC.frame.Y = 0; - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - // 15 texture variants! - Asset textureAsset; - switch (CurrentColor) - { - case (int)FishColor.Radiant: - textureAsset = CurrentShape == (int)FishShape.Angel ? RadiantTexture3 : CurrentShape == (int)FishShape.Cube ? RadiantTexture2 : RadiantTexture; - break; - case (int)FishColor.Gold: - textureAsset = CurrentShape == (int)FishShape.Angel ? GoldTexture3 : CurrentShape == (int)FishShape.Cube ? GoldTexture2 : GoldTexture; - break; - case (int)FishColor.Green: - textureAsset = CurrentShape == (int)FishShape.Angel ? GreenTexture3 : CurrentShape == (int)FishShape.Cube ? GreenTexture2 : GreenTexture; - break; - case (int)FishColor.Pink: - textureAsset = CurrentShape == (int)FishShape.Angel ? PinkTexture3 : CurrentShape == (int)FishShape.Cube ? PinkTexture2 : PinkTexture; - break; - default: - textureAsset = CurrentShape == (int)FishShape.Angel ? Texture3 : CurrentShape == (int)FishShape.Cube ? Texture2 : TextureAssets.Npc[Type]; - break; - } - Texture2D texture = textureAsset.Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / FrameCount / 2)); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / FrameCount)) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Rectangle frame = texture.Frame(1, FrameCount, 0, NPC.frame.Y); - spriteBatch.Draw(texture, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - int dustType = DustID.BlueCrystalShard; - switch (CurrentColor) - { - case (int)FishColor.Pink: - dustType = DustID.PinkCrystalShard; - break; - case (int)FishColor.Green: - dustType = DustID.GemEmerald; - break; - case (int)FishColor.Gold: - dustType = DustID.GoldCritter; - break; - } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); - } - if (CurrentColor < (int)FishColor.Gold) - { - string goreName = CurrentColor switch - { - (int)FishColor.Pink => "PrismaticGuppyPink", - (int)FishColor.Green => "PrismaticGuppyGreen", - _ => "PrismaticGuppyBlue", - }; - CalamityUtils.SpawnGores(NPC, goreName, 3); - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - } - } -} diff --git a/NPCs/SunkenSea/PrismaticGuppy.png b/NPCs/SunkenSea/PrismaticGuppy.png deleted file mode 100644 index 8f7a2ebc88..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppy.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppy2.png b/NPCs/SunkenSea/PrismaticGuppy2.png deleted file mode 100644 index 62a654380c..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppy2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppy3.png b/NPCs/SunkenSea/PrismaticGuppy3.png deleted file mode 100644 index 4ebf0754fe..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppy3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGold.png b/NPCs/SunkenSea/PrismaticGuppyGold.png deleted file mode 100644 index a0e6d461d6..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGold2.png b/NPCs/SunkenSea/PrismaticGuppyGold2.png deleted file mode 100644 index 14b7abe149..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGold2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGold3.png b/NPCs/SunkenSea/PrismaticGuppyGold3.png deleted file mode 100644 index e4f2a4c278..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGold3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGreen.png b/NPCs/SunkenSea/PrismaticGuppyGreen.png deleted file mode 100644 index 1102a61baf..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGreen.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGreen2.png b/NPCs/SunkenSea/PrismaticGuppyGreen2.png deleted file mode 100644 index 17abd52720..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGreen2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyGreen3.png b/NPCs/SunkenSea/PrismaticGuppyGreen3.png deleted file mode 100644 index a57b5a4212..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyGreen3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyPink.png b/NPCs/SunkenSea/PrismaticGuppyPink.png deleted file mode 100644 index 5abdaad83e..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyPink.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyPink2.png b/NPCs/SunkenSea/PrismaticGuppyPink2.png deleted file mode 100644 index bb75923212..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyPink2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyPink3.png b/NPCs/SunkenSea/PrismaticGuppyPink3.png deleted file mode 100644 index b565f6a0b8..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyPink3.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyRadiant.png b/NPCs/SunkenSea/PrismaticGuppyRadiant.png deleted file mode 100644 index fb6a898a3c..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyRadiant2.png b/NPCs/SunkenSea/PrismaticGuppyRadiant2.png deleted file mode 100644 index f5f4e21964..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyRadiant2.png and /dev/null differ diff --git a/NPCs/SunkenSea/PrismaticGuppyRadiant3.png b/NPCs/SunkenSea/PrismaticGuppyRadiant3.png deleted file mode 100644 index ba40e9c3ab..0000000000 Binary files a/NPCs/SunkenSea/PrismaticGuppyRadiant3.png and /dev/null differ diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs deleted file mode 100644 index e0248b265b..0000000000 --- a/NPCs/SunkenSea/Probesnout.cs +++ /dev/null @@ -1,492 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Pathfinding; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Probesnout : SunkenSeaNPC - { - #region Members - - public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 200; - public static int IdleMaxPathDistance = 400; - - public static int FleeTileAnticipationDistance = 5 * 16; - public static int FleeMinPathDistance = 80; - public static int FleeMaxPathDistance = 160; - - protected override List PreyIDs => - [ - NPCType(), - ]; - - protected override List PredatorIDs => - [ - NPCType(), - NPCType(), - NPCType(), - // NPCType(), - // NPCType(), - ]; - - private enum AnimationState { Idle, Eating } - - private AnimationState Animation - { - get => (AnimationState)NPC.ai[1]; - set - { - if (value != Animation) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - switch (value) - { - case AnimationState.Idle: - AnimationFrames = 8; - TimePerAnimationFrame = 5; - break; - case AnimationState.Eating: - AnimationFrames = 12; - TimePerAnimationFrame = 7; - break; - } - - NPC.ai[1] = (float)value; - } - } - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - - private int AnimationFrames = 8; - - private int TimePerAnimationFrame = 5; - - private Vector2 ScaleSquish = Vector2.One; - - private Action _currentBehavior; - private Action CurrentBehavior - { - get => _currentBehavior; - set - { - _previousBehavior = _currentBehavior; - _currentBehavior = value; - } - } - - private Action _previousBehavior; - - private int HuntCooldown - { - get => (int)NPC.ai[3]; - set => NPC.ai[3] = value; - } - - public Vector2 Position => NPC.Center; - - public Vector2 Velocity { get => NPC.velocity; set => NPC.velocity = value; } - - private Vector2 SpongeFoundPosition; - - private bool HasEatenSponge; - - #endregion - - #region AI - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPrey || n == CurrentPredator) && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.4f; - MaxSpeed = 8f; - MinimumPointDistance = 60f; - CurrentBehavior = IdlingBehavior; - NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); - NPC.GravityMultiplier *= 2f; - NPC.MaxFallSpeedMultiplier *= 2f; - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.4f; - MaxSpeed = 8f; - MinimumPointDistance = 60f; - } - CurrentBehavior?.Invoke(); - - NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); - if (CurrentBehavior == EatingBehavior && Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) <= 64f * 64f) - NPC.spriteDirection = NPC.direction = MathF.Sign(SpongeFoundPosition.X - NPC.Center.X); - else if (NPC.velocity.LengthSquared() != 0f) - NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); - - if (Main.rand.NextBool(150) && !HasEatenSponge && CurrentBehavior == IdlingBehavior) - ThreadPool.QueueUserWorkItem(_ => DetectSponges(), null); - - if (Main.rand.NextBool(300) && HasEatenSponge && Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) > 160f * 160f) - HasEatenSponge = false; - - if (!NPC.wet && CurrentBehavior != OutsideWaterBehavior) - { - NPC.noGravity = false; - CurrentBehavior = OutsideWaterBehavior; - } - - if (ScaleSquish.Y > 1f) - ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); - } - - protected override void OnPreyDetection(NPC prey) - { - // If it's not a small fish and it's not being chased by a predator, the Probesnout may hunt. - if (CurrentPredator != null) - return; - - CurrentBehavior = HuntBehavior; - ScaleSquish.Y += 0.4f; - } - - protected override void OnPredatorDetection(NPC predator) - { - // Regardless of anything, if it detects a predator, time to run. - CurrentBehavior = FleeingBehavior; - ScaleSquish.Y += 0.4f; - } - - protected override void OnPlayerDetection(Player player) - { - if (CurrentPredator != null) - return; - - ScaleSquish.Y += 0.4f; - } - - private void IdlingBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(500f, 3000f), SunkenSeaTileValidity)); - MaxSpeed = 6f; - } - - private void FleeingBehavior() - { - // If the avoided entity is gone, go back to idling. - if (CurrentPredator == null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - var headedDirection = CurrentPredator.DirectionTo(NPC.Center) * 200f; - bool tileNotWater = GetIntersectingPointsInLine(NPC.Center, NPC.Center + headedDirection).Any(point => Main.tile[point].IsTileSolid() || Main.tile[point].LiquidAmount < 255); - - if (tileNotWater) - { - do - { - var randomNormalDirection = headedDirection.RotatedBy(MathHelper.PiOver2 * Main.rand.NextBool().ToDirectionInt()); - _randomPathPoint = randomNormalDirection.RotatedByRandom(MathHelper.PiOver4 * 0.7f); - if (!Main.tile[(NPC.Center + _randomPathPoint).ToTileCoordinates()].IsTileSolid()) - break; - } - while (!Main.tile[(NPC.Center + _randomPathPoint).ToTileCoordinates()].IsTileSolid()); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + _randomPathPoint, SunkenSeaTileValidity)); - MaxSpeed = 8f; - } - else - { - NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - } - - private void HuntBehavior() - { - // If there's no more prey, go back to idling. - if (CurrentPrey is null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - bool huntReady = HuntCooldown == 0; - if (huntReady) - HuntCooldown = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, tileValidity: SunkenSeaTileValidity), forceNewTask: huntReady); - MaxSpeed = 8f; - - HuntCooldown--; - } - - private void EatingBehavior() - { - if (Vector2.DistanceSquared(NPC.Center, SpongeFoundPosition) <= 64f * 64f) - { - NPC.velocity *= 0.9f; - Animation = AnimationState.Eating; - if (NPC.frame.Y >= NPC.height * AnimationFrames) - { - HasEatenSponge = true; - Animation = AnimationState.Idle; - CurrentBehavior = IdlingBehavior; - SpongeFoundPosition = Vector2.Zero; - return; - } - } - else - { - pathfinding.DoPathfinding(new(this, NPC.Center, SpongeFoundPosition, SunkenSeaTileValidity)); - MaxSpeed = 6f; - } - } - - private void OutsideWaterBehavior() - { - if (NPC.wet) - { - NPC.noGravity = true; - CurrentBehavior = _previousBehavior; - } - } - - private void DetectSponges() - { - Vector2? spongeFoundPosition = null; - int? tileIndexFound = null; - for (int i = 0; i < 360 && spongeFoundPosition == null; i += 15) - { - var points = GetIntersectingPointsInLine(NPC.Center, NPC.Center - Vector2.UnitY.RotatedBy(MathHelper.ToRadians(i)) * 360f); - for (int j = points.Count - 1; j >= 0; j--) - { - if (Main.tile[points[j]].TileType == TileType()) - { - tileIndexFound = j; - break; - } - } - - if (tileIndexFound == null) - continue; - - for (int k = tileIndexFound.Value; k >= 0; k--) - { - Vector2 worldPos = points[k].ToWorldCoordinates(); - if (NPC.HasSight(worldPos) && SunkenSeaTileValidity(points[k])) - { - CurrentBehavior = EatingBehavior; - spongeFoundPosition = worldPos; - break; - } - } - - tileIndexFound = null; - } - - if (spongeFoundPosition.HasValue) - SpongeFoundPosition = spongeFoundPosition.Value; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - SpawnGores(NPC, "Probesnout", 4); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void AwaitingPathBehavior() - { - if (CurrentBehavior == HuntBehavior) - { - if (CurrentPrey != null) - { - NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - #endregion - - #region Drawing & Animation - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > TimePerAnimationFrame) - { - NPC.frame.Y += frameHeight; - NPC.frame.Y = Math.Min(NPC.frame.Y, AnimationFrames * frameHeight); - NPC.frameCounter = 0; - if (Animation == AnimationState.Idle) - NPC.frame.Y %= AnimationFrames * frameHeight; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 drawPosition = NPC.Center - screenPos; - Rectangle frame = texture.Frame(horizontalFrames: 2, verticalFrames: 12, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); - Vector2 anchorPoint = frame.Size() * 0.5f; - SpriteEffects flip = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); - - return false; - } - - #endregion - - #region Other ModNPC Overrides - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 12; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - } - - public override void SetDefaults() - { - base.SetDefaults(); - - Banner = Type; - BannerItem = ItemType(); - - NPC.lifeMax = 5; - - NPC.npcSlots = 0.1f; - NPC.noGravity = true; - NPC.chaseable = false; - - NPC.width = 44; - NPC.height = 50; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.catchItem = ModContent.ItemType(); - - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } - return 0f; - } - - #endregion - - #region Syncing - - private Vector2 _randomPathPoint; - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(_randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - _randomPathPoint = reader.ReadVector2(); - } - - #endregion - } - - public class ProbesnoutGold : Probesnout - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.rarity = 3; - NPC.catchItem = ItemType(); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; - } - return 0f; - } - } -} diff --git a/NPCs/SunkenSea/Probesnout.png b/NPCs/SunkenSea/Probesnout.png deleted file mode 100644 index ed19b8ecb7..0000000000 Binary files a/NPCs/SunkenSea/Probesnout.png and /dev/null differ diff --git a/NPCs/SunkenSea/ProbesnoutGold.png b/NPCs/SunkenSea/ProbesnoutGold.png deleted file mode 100644 index 81f7389093..0000000000 Binary files a/NPCs/SunkenSea/ProbesnoutGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs deleted file mode 100644 index fa0c0e958e..0000000000 --- a/NPCs/SunkenSea/SandProwler.cs +++ /dev/null @@ -1,725 +0,0 @@ -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SandProwler : SunkenSeaNPC - { - public const int maxLength = 14; - public float speed = 3f; - public float turnSpeed = 0.0625f; - bool TailSpawned = false; - #region Textures - public static Asset BodySprite1; - public static Asset BodySprite2; - public static Asset BodySprite3; - public static Asset BodySprite4; - public static Asset BodySprite5; - public static Asset BodySprite6; - public static Asset BodySprite7; - public static Asset TailSprite; - #endregion - - public enum AnimType - { - None = 0, - Blink = 1, - Bite = 2 - } - - public bool IsHead => NPC.ai[3] == 0; - - public bool IsTail => NPC.ai[3] == 8; - - public ref float CurrentAnimation => ref NPC.localAI[1]; - - public ref float CurrentFrame => ref NPC.localAI[0]; - - public ref float BlinkTimer => ref NPC.localAI[2]; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.CantTakeLunchMoney[Type] = true; // It will only eat coins that the AI says it can, and when it does, you aren't getting them back - if (!Main.dedServ) - { - BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.AsyncLoad); - BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.AsyncLoad); - BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.AsyncLoad); - BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.AsyncLoad); - BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.AsyncLoad); - BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.AsyncLoad); - BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.AsyncLoad); - TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.AsyncLoad); - } - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.damage = 50; - NPC.width = 30; - NPC.height = 24; - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - NPC.waterMovementSpeed = 1; - NPC.GravityIgnoresLiquid = true; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SandProwler") - }); - } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - // only the head gets a healthbar - return IsHead; - } - - - public override void AI() - { - if (IsHead) - HeadAI(); - else - SegmentAI(); - } - public void HeadAI() - { - Point point = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point); - bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; - if (createDust) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); - dust.fadeIn = 0.75f; - dust.velocity *= 0.1f; - dust.noLight = true; - } - } - - if (NPC.ai[2] > 0f) - { - NPC.realLife = (int)NPC.ai[2]; - } - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) - { - NPC.TargetClosest(true); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && NPC.ai[0] == 0f) - { - int Previous = NPC.whoAmI; - for (int segment = 0; segment < maxLength; segment++) - { - int lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - Main.npc[lol].realLife = NPC.whoAmI; - Main.npc[lol].ai[2] = (float)NPC.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - float spriteUse = segment % 2 == 0 ? 3 : 4; // Looping body 3 and 4 - int width = 18; - switch (segment) - { - case maxLength - 1: - spriteUse = 8; // Tail - break; - case maxLength - 2: - spriteUse = 7; // Body 7 - width = 14 ; - break; - case maxLength - 3: - spriteUse = 6; // Body 6 - width = 16; - break; - case maxLength - 4: - spriteUse = 5; // Body 5 - break; - case 0: - spriteUse = 1; // Body 1 - break; - case 1: - spriteUse = 2; // Body 2 - break; - } - Main.npc[lol].ai[3] = spriteUse; - Main.npc[lol].npcSlots = 0; - Main.npc[lol].dontCountMe = true; - Main.npc[lol].width = width; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - } - if (NPC.velocity.X < 0f) - { - NPC.spriteDirection = -1; - } - else if (NPC.velocity.X > 0f) - { - NPC.spriteDirection = 1; - } - if (Main.player[NPC.target].dead) - { - NPC.TargetClosest(false); - } - NPC.alpha -= 42; - if (NPC.alpha < 0) - { - NPC.alpha = 0; - } - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - { - NPC.active = false; - } - float currentSpeed = speed; - float currentTurnSpeed = turnSpeed; - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - Entity targ = CurrentPrey != null ? CurrentPrey : Main.player[NPC.target]; - float targetXDist = targ.position.X + (float)(targ.width / 2); - float targetYDist = targ.position.Y + (float)(targ.height / 2); - bool coinTarget = false; - // fucking run if it notices a predator - if (CurrentPredator != null) - { - Vector2 dirToPred = NPC.DirectionTo(CurrentPredator.Center); - targetXDist = -dirToPred.X * 300; - targetYDist = -dirToPred.Y * 300; - currentSpeed *= 2f; - currentTurnSpeed *= 11.5f; - } - else - { - // Look for silver and gold coins to eat - for (int i = 0; i < Main.maxItems; i++) - { - Item item = Main.item[i]; - // continue if not an active silver or gold coin - if (item == null || !item.active || (item.type != ItemID.SilverCoin && item.type != ItemID.GoldCoin)) - continue; - // can only look for coins in a 75 tile radius - if (item.Distance(NPC.Center) > 1200) - continue; - // if its head touches the coin, eat it - if (item.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = item.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - item.active = false; - break; - } - // if it isn't touching the coin, go to it - targetXDist = item.Center.X; - targetYDist = item.Center.Y; - coinTarget = true; - break; - } - } - // aggro on coins takes priority over players - if (CurrentPredator == null && (NPC.life > NPC.lifeMax * 0.99 && targ is Player) && !coinTarget) - { - targetYDist += 300; - if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) - { - if (NPC.velocity.X > 0f) - { - targetXDist = Main.player[NPC.target].Center.X + 300f; - } - else - { - targetXDist = Main.player[NPC.target].Center.X - 300f; - } - } - - // Blink every so often - if (Main.rand.NextBool(600) && CurrentAnimation == (int)AnimType.None && BlinkTimer <= 0) - { - CurrentAnimation = (int)AnimType.Blink; - BlinkTimer = Main.rand.NextBool(4) ? 48 : 24; - } - } - else if (CurrentPredator == null) - { - currentSpeed *= 1.5f; - currentTurnSpeed *= 1.5f; - } - float maxCurrentSpeed = currentSpeed * 1.3f; - float minCurrentSpeed = currentSpeed * 0.7f; - float speedCompare = NPC.velocity.Length(); - if (speedCompare > 0f) - { - if (speedCompare > maxCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxCurrentSpeed; - } - else if (speedCompare < minCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= minCurrentSpeed; - } - } - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float absoluteTargetX = System.Math.Abs(targetXDist); - float absoluteTargetY = System.Math.Abs(targetYDist); - float timeToReachTarget = currentSpeed / targetDistance; - targetXDist *= timeToReachTarget; - targetYDist *= timeToReachTarget; - if (targetDistance < 128 && targ is NPC || (NPC.life <= NPC.lifeMax * 0.99 && targ is Player) || coinTarget) - { - CurrentAnimation = (int)AnimType.Bite; - } - else if (CurrentAnimation != (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - BlinkTimer--; - if (BlinkTimer <= 0) - { - BlinkTimer = 0; - if (CurrentAnimation == (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - } - if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; - } - } - if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 - } - } - } - else - { - if (absoluteTargetX > absoluteTargetY) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - } - else - { - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - } - } - NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - } - - public void SegmentAI() - { - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType() && Main.npc[i].ai[3] == 0) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float headDivisor = 1; - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2 / headDivisor) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override void FindFrame(int frameHeight) - { - if (IsTail) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.localAI[0]++; - NPC.frameCounter = 0; - } - if (NPC.localAI[0] > 7) - { - NPC.localAI[0] = 0; - } - } - if (IsHead) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - switch (CurrentAnimation) - { - case (int)AnimType.None: - NPC.frame.Y = 0; - break; - case (int)AnimType.Bite: - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - break; - case (int)AnimType.Blink: - if (NPC.frame.Y < frameHeight || NPC.frame.Y > frameHeight * 4) - { - NPC.frame.Y = frameHeight; - } - break; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && - !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override bool CheckActive() - { - return IsHead; - } - - protected override bool NPCSearchFilter(NPC n) - { - float huntRange = 600f; - float avoidRange = 200f; - bool preyFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < huntRange * huntRange && PreyIDs.Contains(n.type); - bool predFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < avoidRange * avoidRange && PredatorIDs.Contains(n.type); - bool hidingGuppy = n.type == ModContent.NPCType() && n.alpha > 0; - return !hidingGuppy && (preyFilter || predFilter); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitNPC(NPC target) - { - return IsHead; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - if (IsHead) - NPC.chaseable = true; - else - Main.npc[NPC.realLife].chaseable = true; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); - - public static void DefineSandProwlerLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 4); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); - } - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D segmentSprite = TextureAssets.Npc[Type].Value; - if (NPC.IsABestiaryIconDummy) - { - NPC.frame = segmentSprite.Frame(); - // Buffers the segment position and rotations - float offset = -0.2f; - float startX = 0; - float startY = 0; - int segmentSpacing = 16; - int animationSpeed = 5; - float wormTimer = NPC.Calamity().bestiaryWormTimer; - // Draw the body segments - for (int i = 7; i > 0; i--) - { - // The first segment is slightly closer to keep up with the head - float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; - - Texture2D toUse = i == 1 ? BodySprite1.Value : i == 2 ? BodySprite2.Value : i % 2 == 0 ? BodySprite3.Value : BodySprite4.Value; - spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Width / 2), NPC.scale, SpriteEffects.None, 0f); - } - // Draw the head - spriteBatch.Draw(segmentSprite, NPC.position + new Vector2(startX, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), segmentSprite.Frame(1, 11, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(segmentSprite.Width * 0.5f, segmentSprite.Height / 11), NPC.scale, SpriteEffects.None, 0f); - - return false; - } - switch (NPC.ai[3]) - { - case 0: - break; - case 1: - segmentSprite = BodySprite1.Value; - break; - case 2: - segmentSprite = BodySprite2.Value; - break; - case 3: - segmentSprite = BodySprite3.Value; - break; - case 4: - segmentSprite = BodySprite4.Value; - break; - case 5: - segmentSprite = BodySprite5.Value; - break; - case 6: - segmentSprite = BodySprite6.Value; - break; - case 7: - segmentSprite = BodySprite7.Value; - break; - case 8: - segmentSprite = TailSprite.Value; - break; - default: - segmentSprite = NPC.ai[3] % 2 == 0 ? BodySprite4.Value : BodySprite3.Value; - break; - } - float frameDivisor = IsTail ? 8 : IsHead ? Main.npcFrameCount[Type] : 1; - Vector2 origin = new Vector2(segmentSprite.Width / 2, segmentSprite.Height / 2 / frameDivisor); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(segmentSprite.Width, segmentSprite.Height / frameDivisor) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - SpriteEffects fx = NPC.oldPos[1].X < NPC.position.X ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Rectangle frame = segmentSprite.Frame(1, 1, 0, 0); - if (IsHead) - { - frame = NPC.frame; - } - else if (IsTail) - { - frame = segmentSprite.Frame(1, 8, 0, (int)NPC.localAI[0]); - } - spriteBatch.Draw(segmentSprite, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, fx, 0f); - return false; - } - } -} diff --git a/NPCs/SunkenSea/SandProwler.png b/NPCs/SunkenSea/SandProwler.png deleted file mode 100644 index a36c31ffbb..0000000000 Binary files a/NPCs/SunkenSea/SandProwler.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler2.png b/NPCs/SunkenSea/SandProwler2.png deleted file mode 100644 index bb3fe551b5..0000000000 Binary files a/NPCs/SunkenSea/SandProwler2.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler3.png b/NPCs/SunkenSea/SandProwler3.png deleted file mode 100644 index 7a33532959..0000000000 Binary files a/NPCs/SunkenSea/SandProwler3.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler4.png b/NPCs/SunkenSea/SandProwler4.png deleted file mode 100644 index 8588ffaa7e..0000000000 Binary files a/NPCs/SunkenSea/SandProwler4.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler5.png b/NPCs/SunkenSea/SandProwler5.png deleted file mode 100644 index c1b0777eeb..0000000000 Binary files a/NPCs/SunkenSea/SandProwler5.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler6.png b/NPCs/SunkenSea/SandProwler6.png deleted file mode 100644 index b9304a7630..0000000000 Binary files a/NPCs/SunkenSea/SandProwler6.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler7.png b/NPCs/SunkenSea/SandProwler7.png deleted file mode 100644 index bbed0cae7f..0000000000 Binary files a/NPCs/SunkenSea/SandProwler7.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler8.png b/NPCs/SunkenSea/SandProwler8.png deleted file mode 100644 index c722b5e8f5..0000000000 Binary files a/NPCs/SunkenSea/SandProwler8.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler9.png b/NPCs/SunkenSea/SandProwler9.png deleted file mode 100644 index 594b3586ae..0000000000 Binary files a/NPCs/SunkenSea/SandProwler9.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs deleted file mode 100644 index 8a95c7e615..0000000000 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ /dev/null @@ -1,504 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.GameContent.Bestiary; -using CalamityMod.Enums; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class SandProwlerNested : SunkenSeaNPC - { - public bool PeekingOut; - public bool HasChosenSpotToHideIn => SpotToHideIn != Vector2.Zero; - public Point TileCoordsToHideIn - { - get => SpotToHideIn.ToTileCoordinates(); - set => SpotToHideIn = value.ToWorldCoordinates(); - } - public Vector2 SpotToHideIn - { - get => new Vector2(NPC.ai[0], NPC.ai[1]); - set - { - NPC.ai[0] = value.X; - NPC.ai[1] = value.Y; - } - } - - public bool InHidingSpot => NPC.WithinRange(SpotToHideIn, 8f); - - public bool RetreatingToHidingSpot - { - get => NPC.ai[2] == 1f; - set => NPC.ai[2] = value.ToInt(); - } - - public ref float SnapTimer => ref NPC.ai[3]; - public ref float SnapCooldown => ref NPC.localAI[0]; - public ref float InitialSnapDirection => ref NPC.localAI[1]; - public ref float CurrentSnapDirection => ref NPC.localAI[2]; - public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler"; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - NPCID.Sets.TrailingMode[Type] = 0; - NPCID.Sets.TrailCacheLength[Type] = 60; - NPCID.Sets.UsesNewTargetting[Type] = true; - NPCID.Sets.CantTakeLunchMoney[Type] = true; - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - NPC.damage = 50; - NPC.width = 30; - NPC.height = 30; //32 - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; - NPC.netAlways = true; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - NPC.waterMovementSpeed = 1f; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(PeekingOut); - writer.Write(SnapCooldown); - writer.Write(InitialSnapDirection); - writer.Write(CurrentSnapDirection); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - PeekingOut = reader.ReadBoolean(); - SnapCooldown = reader.ReadSingle(); - InitialSnapDirection = reader.ReadSingle(); - CurrentSnapDirection = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - NPC.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - // Choose an initial tile to hide in. - if (Main.netMode != NetmodeID.MultiplayerClient && !HasChosenSpotToHideIn) - { - int tries; - for (tries = 0; tries < 1800; tries++) - { - int x = (int)(NPC.Center.X / 16f) + Main.rand.Next(-25, 25); - int y = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-25, 25); - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - - // Try again if the tile isn't solid or isn't exposed to air. - if (!WorldGen.SolidTile(tile) || !CalamityUtils.IsTileExposedToAir(x, y, out float? angleToOpenAir)) - continue; - - // Try again if there's no open water near the tile. - Vector2 moveDirection = angleToOpenAir.Value.ToRotationVector2(); - Vector2 collisionCheckPosition = new Vector2(x * 16f + 8f, y * 16f + 8f) + moveDirection * 16f; - float collisionDistance = CalamityUtils.DistanceToTileCollisionHit(collisionCheckPosition, moveDirection, 20) ?? 20; - if (collisionDistance <= 10) - continue; - - TileCoordsToHideIn = new Point(x, y); - break; - } - - // Just die if no spot was suitable. - if (tries >= 1799) - NPC.active = false; - - NPC.Center = SpotToHideIn; - NPC.netUpdate = true; - } - - Entity target = null; - - // Look for coins - for (int i = 0; i < Main.maxItems; i++) - { - Item n = Main.item[i]; - if (n == null || !n.active || (n.type != ItemID.SilverCoin && n.type != ItemID.GoldCoin)) - continue; - // if its head touches the coin, eat it - if (n.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = n.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - n.active = false; - break; - } - // Set the coin as the target - if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) - { - target = n; - } - } - // Go after sea minnows if not distracted by shiny coin - if (target == null) - { - if (NPC.life > NPC.lifeMax * 0.99f) - { - if (CurrentPrey != null) - target = CurrentPrey; - } - // If you've pissed it off, it now goes after YOU - else - { - NPC.TargetClosest(false); - target = Main.player[NPC.target]; - } - } - - // Open mouth when launching towards a target - if (SnapTimer > 0 && target != null && !PeekingOut) - { - NPC.Calamity().newAI[1] = 1; - } - else if (RetreatingToHidingSpot || InHidingSpot) - { - NPC.Calamity().newAI[1] = 0; - } - - // Become invulnerable and mostly transparent if hiding in a tile. - NPC.dontTakeDamage = InHidingSpot; - NPC.Opacity = MathHelper.Clamp(NPC.Opacity - NPC.dontTakeDamage.ToDirectionInt(), 0.35f, 1f); - - // Also emit some particle effects as an indicator. - if (InHidingSpot) - { - Dust sparkle = Dust.NewDustDirect(TileCoordsToHideIn.ToWorldCoordinates(0, 0), 16, 16, DustID.AncientLight); - sparkle.color = Color.Orange; - sparkle.velocity = Main.rand.NextVector2Circular(4f, 4f); - sparkle.noGravity = true; - } - - // Decide rotation. - NPC.rotation = NPC.AngleFrom(SpotToHideIn) + MathHelper.PiOver2; - - // Prevent the tile from being destroyed. - FixExploitManEaters.ProtectSpot(TileCoordsToHideIn.X, TileCoordsToHideIn.Y); - - // Do nothing other than hiding if instructed to do so. - if (RetreatingToHidingSpot) - { - NPC.velocity = NPC.SafeDirectionTo(SpotToHideIn) * 0.002f; - NPC.position += NPC.velocity.SafeNormalize(Vector2.Zero) * 5f; - - // Stop once the hiding spot has been reached. - if (InHidingSpot) - { - NPC.Center = SpotToHideIn; - NPC.velocity = Vector2.Zero; - RetreatingToHidingSpot = false; - NPC.netUpdate = true; - } - - return; - } - - // Don't do any snapping and such if the cooldown is active. - if (SnapCooldown > 0f) - { - SnapCooldown--; - if (SnapCooldown <= 0f) - NPC.netUpdate = true; - return; - } - - if (SnapTimer > 0f) - { - int snapTime = PeekingOut ? 45 : 32; - float idealSpeed = PeekingOut ? 1.75f : 10f; - float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); - NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; - - // Get closer to the target if one not peeking. - if (!PeekingOut && target != null) - CurrentSnapDirection = CurrentSnapDirection.AngleTowards(NPC.AngleTo(target.Center), 0.0125f); - - // Retreat if velocity is zero for some reason. - if (NPC.velocity == Vector2.Zero) - { - SnapTimer = 0f; - RetreatingToHidingSpot = true; - NPC.netUpdate = true; - return; - } - - SnapTimer++; - if (SnapTimer >= snapTime || (Collision.SolidCollision(NPC.Center, 1, 1) && SnapTimer > 5f)) - { - SnapTimer = 0f; - SnapCooldown = 35f; - PeekingOut = false; - RetreatingToHidingSpot = true; - } - - return; - } - - Vector2 snapDirection = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * Main.rand.Next(4)); - - // Pick a potential direction to snap out. - // This is important for attacking. - int snapDirectionTries = 0; - float targetSnapAngularThreshold = 0.48f; - while ((CalamityUtils.DistanceToTileCollisionHit(SpotToHideIn, snapDirection, 50) ?? 50f) < 5f) - { - snapDirectionTries++; - snapDirection = snapDirection.RotatedBy(MathHelper.PiOver2); - - if (snapDirectionTries >= 8) - return; - - // Try again if there's a defined target and it isn't in the line of sight of the current direction. - if (target != null && snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) > targetSnapAngularThreshold) - continue; - } - - // Snap out if a suitable target gets close. - // Otherwise, sometimes randomly peek out. - bool canSnapAtTarget = - target != null && - snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) < targetSnapAngularThreshold && - Collision.CanHit(NPC.Center + snapDirection * 12f, 1, 1, target.Center, 1, 1); - if (Main.rand.NextBool(30) && !canSnapAtTarget) - PeekingOut = true; - - if (PeekingOut || canSnapAtTarget) - { - if (canSnapAtTarget) - SoundEngine.PlaySound(SoundID.Item96, NPC.Center); - else - SoundEngine.PlaySound(SoundID.Item95, NPC.Center); - - // Add some randomness when peeking. - if (PeekingOut) - snapDirection = snapDirection.RotatedByRandom(MathHelper.Pi / 6f); - - NPC.velocity = snapDirection * 4f; - InitialSnapDirection = CurrentSnapDirection = NPC.velocity.ToRotation(); - SnapTimer = 1f; - NPC.netUpdate = true; - } - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - NPC.chaseable = true; - } - - public override void FindFrame(int frameHeight) - { - if (NPC.Calamity().newAI[1] == 1) - { - NPC.frameCounter++; - if (NPC.frameCounter > 3) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - } - else - { - NPC.frameCounter = 0; - NPC.frame.Y = 0; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (InHidingSpot) - return false; - - Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D body1Texture = SandProwler.BodySprite1.Value; - Texture2D body2Texture = SandProwler.BodySprite2.Value; - Texture2D body3Texture = SandProwler.BodySprite3.Value; - Texture2D body4Texture = SandProwler.BodySprite4.Value; - - Vector2 idealDrawPosition = SpotToHideIn; - Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; - if (Collision.SolidCollision(idealDrawPosition + backOffset, 4, 4)) - idealDrawPosition += backOffset; - - List bezierPoints = new List() - { - idealDrawPosition - }; - - // Calculate points to create segments at based on a catmull-rom spine. - float bendFactor = Utils.GetLerpValue(80f, 250f, NPC.Distance(idealDrawPosition), true); - for (int i = 0; i < 20; i++) - { - Vector2 leftEnd = idealDrawPosition - InitialSnapDirection.ToRotationVector2() * bendFactor * 450f; - Vector2 rightEnd = NPC.Center + CurrentSnapDirection.ToRotationVector2() * bendFactor * 450f; - bezierPoints.Add(Vector2.CatmullRom(leftEnd, idealDrawPosition, NPC.Center, rightEnd, i / 19f)); - } - bezierPoints.Add(NPC.Center); - - // And then generalize them with a bezier curve. - BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); - int totalChains = (int)(NPC.Distance(idealDrawPosition) / 16f); - totalChains = (int)MathHelper.Clamp(totalChains, 2f, 100f); - - for (int i = 0; i < totalChains - 1; i++) - { - Texture2D textureToUse; - - - if (i % 2 == 0) - { - textureToUse = body3Texture; - } - else - { - textureToUse = body4Texture; - } - - switch (totalChains - i - 1) - { - case 1: - textureToUse = headTexture; - break; - case 2: - textureToUse = body1Texture; - break; - case 3: - textureToUse = body2Texture; - break; - } - - Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); - Color lightColor = Lighting.GetColor((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); - float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation() + MathHelper.PiOver2; - Rectangle frame = textureToUse.Frame(1, 1, 0, 0); - if (textureToUse == headTexture) - { - frame = NPC.frame; - } - Vector2 origin = new Vector2(textureToUse.Width / 2, textureToUse.Height / (textureToUse == headTexture ? 22 : 2)); - spriteBatch.Draw(textureToUse, drawPosition - Main.screenPosition, frame, lightColor, angle, origin, NPC.scale, SpriteEffects.None, 0f); - } - return false; - } - protected override bool NPCSearchFilter(NPC n) - { - return Vector2.DistanceSquared(NPC.Center, n.Center) < 200f * 200f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return NPC.life < NPC.lifeMax * 0.99f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0 && !Main.dedServ) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); - } - } - public override void OnKill() - { - // Increase the kill count of Sand Prowlers for the Bestiary - if (NPC.GetWereThereAnyInteractions()) - { - NPC nPC = new NPC(); - nPC.SetDefaults(ModContent.NPCType()); - Main.BestiaryTracker.Kills.RegisterKill(nPC); - } - } - } -} diff --git a/NPCs/SunkenSea/Scavenger.cs b/NPCs/SunkenSea/Scavenger.cs deleted file mode 100644 index a3875226c1..0000000000 --- a/NPCs/SunkenSea/Scavenger.cs +++ /dev/null @@ -1,999 +0,0 @@ -using CalamityMod.BiomeManagers; -using CalamityMod.Enums; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Fishing.SunkenSeaCatches; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Items.Placeables.FurnitureDriftwood; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using System; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Utilities; -using CalamityMod.Items.Placeables.Banners; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Scavenger : SunkenSeaNPC - { - public record ScavengerItem(int itemID, int minimum, int maximum, Func condition); - - public static Asset walkTexture; - - public static Asset inspectTexture; - - public static Asset giveTexture; - - public static Dictionary> ScavengerLoot = new Dictionary>() - { - { ItemID.WhitePearl, new WeightedRandom() }, - { ItemID.BlackPearl, new WeightedRandom() }, - { ItemID.PinkPearl, new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - { ItemID.GalaxyPearl, new WeightedRandom() }, - { ModContent.ItemType(), new WeightedRandom() }, - }; - - public enum PhaseType - { - Idle = 0, - FoundItem = 1, - Bartering = 2, - Burrow = 3 - } - - // The in world index of the item the crab is going after - public int HeldItemIndex - { - get => (int)NPC.ai[1] - 1; - set => NPC.ai[1] = value + 1; - } - - // The type of currency the crab is currently holding - public int HeldItemType - { - get => (int)NPC.ai[2]; - set => NPC.ai[2] = value; - } - - // The crab's current behaviour - public ref float Phase => ref NPC.ai[0]; - - // Used during trading and as a cooldown - public ref float TradeTimer => ref NPC.ai[3]; - - public ref float WalkTimer => ref NPC.Calamity().newAI[0]; - - public ref float TurnTimer => ref NPC.Calamity().newAI[1]; - - public ref float WalkOrStand => ref NPC.Calamity().newAI[2]; - - public ref float StackMin => ref NPC.localAI[0]; - - public ref float StackMax => ref NPC.localAI[1]; - - public ref float OldItemType => ref NPC.localAI[2]; - - public bool ShouldUseWalkingFrames => NPC.velocity.X != 0 && ((WalkOrStand == 1 && Phase == (int)PhaseType.Idle) || (Phase == (int)PhaseType.FoundItem)); - - public bool ShouldUseInspectionFrames => Phase == (int)PhaseType.Bartering && TradeTimer < 80; - - public bool ShouldUseGivingFrames => Phase == (int)PhaseType.Bartering && TradeTimer >= 80; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.TimelessShores; - - protected override List PreyIDs => new List - { - - }; - - protected override List PredatorIDs => new List - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[NPC.type] = 1; - NPCID.Sets.CantTakeLunchMoney[Type] = true; - Main.npcFrameCount[Type] = 7; - - InitializeScavengerLoot(); - - if (!Main.dedServ) - { - walkTexture = ModContent.Request(Texture + "Walking"); - inspectTexture = ModContent.Request(Texture + "Inspecting"); - giveTexture = ModContent.Request(Texture + "Giving"); - } - } - - #region Trades - - public static void InitializeScavengerLoot() - { - int white = ItemID.WhitePearl; - int black = ItemID.BlackPearl; - int pink = ItemID.PinkPearl; - int minBlock = 6; - int maxBlock = 17; - float coralBlockChance = 0.1f; - - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ModContent.ItemType(), minBlock, maxBlock, coralBlockChance); - AddScavengerItem(white, ItemID.WoodenCrate, 1, () => !Main.hardMode, 0.1f); - AddScavengerItem(white, ItemID.WoodenCrateHard, 1, () => Main.hardMode, 0.1f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.1f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.1f); - AddScavengerItem(white, ItemID.ScarabBomb, 3, 10, 0.1f); - AddScavengerItem(white, ItemID.Coral, 3, 10, 0.2f); - AddScavengerItem(white, ItemID.Starfish, 3, 10, 0.2f); - AddScavengerItem(white, ItemID.Seashell, 3, 10, 0.2f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - // Critters. Golds, Radiants, Pearlpods and any Basalt Gully/Timeless Shore critters are to be excluded - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - - AddScavengerItem(black, ModContent.ItemType(), 1, () => !Main.hardMode, 0.1f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.PirateMap, 1, () => Main.hardMode, 0.05f); - AddScavengerItem(black, ItemID.IronCrate, 1, () => !Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.IronCrateHard, 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.GoldenCrate, 1, () => !Main.hardMode, 0.02f); - AddScavengerItem(black, ItemID.GoldenCrateHard, 1, () => Main.hardMode, 0.02f); - AddScavengerItem(black, ItemID.WaterWalkingBoots, 1, 0.05f); - AddScavengerItem(black, ItemID.FishingBobber, 1, 0.05f); - AddScavengerItem(black, ItemID.JellyfishNecklace, 1, 0.05f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); - //AddScavengerItem(black, ItemID.Nachos, 1, 0.05f); insert food item - AddScavengerItem(black, ModContent.ItemType(), 1, () => DownedBossSystem.downedDesertScourge, 0.3f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => DownedBossSystem.downedDesertScourge, 0.3f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ModContent.ItemType(), 1, () => Main.hardMode, 0.1f); - AddScavengerItem(black, ItemID.FinWings, 1, () => Main.hardMode, 0.1f); - - AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - AddScavengerItem(pink, ModContent.ItemType(), 1); - AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - //AddScavengerItem(pink, ModContent.ItemType(), 1); - AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); - AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); - - // Pearlpods can be used as a substitute for pearls - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[white]; - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[black]; - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; - - ScavengerLoot[ItemID.GalaxyPearl] = ScavengerLoot[white]; // Gives 1-2x the amount of white items - ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; // Gives 2 pink items - - } - - #region Loot adding methods - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// The minimum amount to drop - /// The maximum amount to drop - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int min, int max, float weight = 1) - { - AddScavengerItem(currency, itemID, min, max, () => true, weight); - } - - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// How much should drop - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int amount, float weight = 1) - { - AddScavengerItem(currency, itemID, amount, amount, () => true, weight); - } - - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// How much should drop - /// A condition - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int amount, Func condition, float weight = 1) - { - AddScavengerItem(currency, itemID, amount, amount, condition, weight); - } - - /// - /// Adds an item to the Scavenger's loot pool - /// - /// The item type required to be traded - /// The loot item - /// The minimum amount to drop - /// The maximum amount to drop - /// A condition - /// The weight of the item drop. Lower numbers means lower chances - public static void AddScavengerItem(int currency, int itemID, int min, int max, Func condition, float weight = 1) - { - if (ScavengerLoot.ContainsKey(currency)) - { - ScavengerLoot[currency].Add(new ScavengerItem(itemID, min, max, condition), weight); - } - else - { - ScavengerLoot.Add(currency, new WeightedRandom()); - ScavengerLoot[currency].Add(new ScavengerItem(itemID, min, max, condition), weight); - } - } - #endregion - #endregion - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.damage = 20; - NPC.width = 48; - NPC.height = 48; - NPC.defense = 5; - NPC.lifeMax = 350; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(silver: 5); - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.knockBackResist = 0.15f; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.chaseable = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Scavenger") - }); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.Calamity().newAI[0] = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - NPC.Calamity().newAI[2] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.Calamity().newAI[0]); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(NPC.Calamity().newAI[2]); - } - - public override void AI() - { - // Check to make sure the target item still exists - if (HeldItemIndex > 0) - { - Item targetItem = Main.item[HeldItemIndex]; - // If the item doesn't exist, reset its held item - if (targetItem == null || !targetItem.active) - { - HeldItemIndex = -1; - } - } - - // Initialize its direction - if (NPC.direction == 0) - NPC.direction = Main.rand.NextBool() ? -1 : 1; - - switch (Phase) - { - // Do idle stuff, actual behavior not determined rn - case (int)PhaseType.Idle: - { - // Decide if it should walk or sit - float movementSpeed = CurrentPrey != null || CurrentPredator != null ? 2 : 1; - bool startMovement = false; - if (WalkTimer <= 0) - { - WalkTimer = Main.rand.Next(180, 340); - WalkOrStand = WalkOrStand <= 0 ? 1 : -1; - if (WalkOrStand == 1 && Main.rand.NextBool() && CurrentPrey == null) - { - NPC.direction *= -1; - } - if (CurrentPrey != null) - { - NPC.direction = (int)(CurrentPrey.Center.X - NPC.Center.X); - } - startMovement = true; - } - bool lookingAtPredator = CurrentPredator != null && NPC.direction == Math.Sign(CurrentPredator.Center.X - NPC.Center.X); - bool waterCheck = WaterCheck(16); - // If it bumps into something, jump or turn around - if ((!startMovement && TurnTimer <= 0 && (NPC.velocity.X == 0 || waterCheck) && WalkOrStand == 1) || lookingAtPredator) - { - // Jump if there are a couple tiles and a space above - if (!waterCheck && JumpCheck() && NPC.velocity.Y == 0 && !lookingAtPredator) - { - NPC.velocity.Y -= 7; - NPC.velocity.X = movementSpeed * NPC.direction; - WalkOrStand = 1; - TurnTimer = 10; - } - // Turn around if it can't jump up or a pit/water is in the way - else - { - NPC.direction *= -1; - TurnTimer = 30; - } - } - // Move - if (!NPC.justHit) - { - if (WalkOrStand == 1) - NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); - else if (NPC.velocity.Y == 0) - NPC.velocity.X *= 0.95f; - } - else if (WalkOrStand == -1) - { - WalkTimer = 0; - if (CurrentPredator != null) - { - WalkOrStand = 1; - WalkTimer = Main.rand.Next(180, 340); - } - } - CalamityUtils.StepUpBlocks(NPC); - - // If the trade timer is 0 and the crab isn't looking ofr an item, look for an item - if (TradeTimer >= 0 && HeldItemIndex <= -1 && CurrentPredator == null) - { - float curDist = 0; - bool superRare = false; - foreach (Item i in Main.ActiveItems) - { - if (!i.active) - continue; - if (i.beingGrabbed) - continue; - float distance = i.Distance(NPC.Center); - if (distance > 460) - continue; - if (!NPC.HasSight(i.Center)) - continue; - if (Math.Abs(NPC.Center.Y - i.Center.Y) > 100) - continue; - - // Check if the item is a valid currency and is the closest possible currency - if (ScavengerLoot.ContainsKey(i.type)) - { - if (distance < curDist || curDist == 0) - { - HeldItemIndex = i.whoAmI; - superRare = i.type > ItemID.PinkPearl ? true : false; - } - curDist = distance; - } - } - // If an item was found, go after it - if (curDist != 0) - { - NPC.netUpdate = true; - Phase = (int)PhaseType.FoundItem; - TurnTimer = 0; - WalkTimer = 0; - if (NPC.velocity.Y == 0) - NPC.velocity.Y = -5; - NPC.direction = NPC.DirectionTo(Main.item[HeldItemIndex].Center).X.DirectionalSign(); - - SoundEngine.PlaySound(SoundID.NPCHit51 with { Pitch = -0.4f }, NPC.Center); - - EmoteExpressionParticle.EmoteType eType = superRare ? EmoteExpressionParticle.EmoteType.DoubleExclamation : EmoteExpressionParticle.EmoteType.Exclamation; - - var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.YellowGreen, - Main.rand.Next(30, 46), - eType); - GeneralParticleHandler.SpawnParticle(emote); - } - } - // Increment the trade timer back to zero if it is below zero - if (TradeTimer < 0) - TradeTimer++; - } - break; - // Go to the item - case (int)PhaseType.FoundItem: - { - // If the item is no longer valid, go back to idle behaviour - if (HeldItemIndex <= -1 || CurrentPredator != null) - { - NPC.netUpdate = true; - Phase = (int)PhaseType.Idle; - HeldItemIndex = -1; - TurnTimer = 0; - WalkTimer = 0; - return; - } - - // If the item is suddenly no longer valid for some reason, go back to idle behaviour - Item targetItem = Main.item[HeldItemIndex]; - if (!targetItem.active || !ScavengerLoot.ContainsKey(targetItem.type)) - { - NPC.netUpdate = true; - targetItem.noGrabDelay = 0; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - HeldItemIndex = -1; - NPC.velocity = Vector2.Zero; - Phase = (int)PhaseType.Idle; - TurnTimer = 0; - WalkTimer = 0; - break; - } - - // Once the jump anim is done, go to the pearl - if (WalkTimer > 0) - { - float movementSpeed = 3; - bool waterCheck = WaterCheck(16); - // If it bumps into something, jump or turn around - if (TurnTimer <= 0 && (NPC.velocity.X == 0 || waterCheck) && NPC.velocity.Y == 0) - { - // Jump if there are a couple tiles and a space above - if (!waterCheck && JumpCheck()) - { - NPC.velocity.Y -= 8; - NPC.velocity.X = movementSpeed * NPC.direction; - TurnTimer = 10; - } - // Turn around if it can't jump up or a pit/water is in the way - else - { - NPC.direction *= -1; - TurnTimer = 30; - NPC.netUpdate = true; - targetItem.noGrabDelay = 0; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - HeldItemIndex = -1; - Phase = (int)PhaseType.Idle; - TurnTimer = 0; - WalkTimer = 0; - } - } - // Change direction if the item position changed - bool itemOnRight = targetItem.Center.X > NPC.Center.X; - if (itemOnRight && NPC.direction == -1) - { - NPC.direction *= -1; - } - else if (!itemOnRight && NPC.direction == 0) - { - NPC.direction *= -1; - } - TurnTimer--; - - NPC.velocity.X = NPC.direction * movementSpeed; - CalamityUtils.StepUpBlocks(NPC); - } - // While the jump animation is occurring, slow down horizontally - else - { - NPC.velocity.X *= 0.95f; - } - // Marks if the jump animation is finished - if (NPC.velocity.Y == 0) - { - WalkTimer++; - } - - // Pull the item if close enough - if (targetItem.Distance(NPC.Center) < 120) - { - targetItem.noGrabDelay = 100; - targetItem.velocity = targetItem.DirectionTo(NPC.Center) * 5; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - } - // Grab the item if close enough - if (targetItem.Distance(NPC.Center) < 10) - { - Phase = (int)PhaseType.Bartering; - // If the item's stack is 1, despawn the item. Otherwise decrement its stack by 1. - if (targetItem.stack == 1) - targetItem.active = false; - else - targetItem.stack--; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, targetItem.whoAmI, 1, 0f, 0f, 0, 0, 0); - } - // Set the crab's held item type - HeldItemType = targetItem.type; - TurnTimer = 0; - WalkTimer = 0; - NPC.netUpdate = true; - } - } - break; - // Ponder the held item then give a reward back - case (int)PhaseType.Bartering: - { - if (CurrentPredator != null) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Item.NewItem(NPC.GetSource_FromThis(), NPC.getRect(), HeldItemType); - } - - NPC.netUpdate = true; - HeldItemIndex = -1; - Phase = (int)PhaseType.Idle; - TurnTimer = 0; - WalkTimer = 0; - OldItemType = 0; - StackMin = 0; - StackMax = 0; - - SoundEngine.PlaySound(SoundID.NPCHit51 with { Pitch = -0.3f }, NPC.Center); - - EmoteExpressionParticle.EmoteType eType = EmoteExpressionParticle.EmoteType.Exclamation; - - var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Red, - Main.rand.Next(30, 46), - eType); - GeneralParticleHandler.SpawnParticle(emote); - return; - } - NPC.velocity.X *= NPC.velocity.Y != 0 ? 0.96f : 0.9f; - TradeTimer++; - // Calculate the reward - if (TradeTimer == 132) - { - NPC.netUpdate = true; - OldItemType = HeldItemType; - HeldItemType = CalculateReward(out int min, out int max); - StackMin = min; - StackMax = max; - } - - // After some time, spit out a reward and go back to idle with a cooldown - if (TradeTimer > 160) - { - NPC.netUpdate = true; - HeldItemIndex = -1; - Phase = (int)PhaseType.Idle; - // This timer increments during its idle phase so it's set to a negative value - // Once the value hits zero, the crab will be able to trade again - TradeTimer = -CalamityUtils.SecondsToFrames(8); - - // Spawn the reward - if (HeldItemType > 0) - { - float stackMult = 1; - int dropAmt = 1; - if (ContentSamples.ItemsByType[HeldItemType].maxStack > 1) - { - if (OldItemType == ModContent.ItemType()) - stackMult *= 2; - if (OldItemType == ItemID.GalaxyPearl) - stackMult *= Main.rand.NextFloat(1.2f, 2f); - } - else - { - if (OldItemType == ModContent.ItemType()) - dropAmt *= 2; - if (OldItemType == ItemID.GalaxyPearl) - dropAmt *= 2; - } - for (int i = 0; i < dropAmt; i++) - { - SpawnItem(HeldItemType, stackMult); - } - } - HeldItemType = 0; - OldItemType = 0; - StackMin = 0; - StackMax = 0; - } - } - break; - // Burrow away and despawn - case (int)PhaseType.Burrow: - { - NPC.velocity.X *= 0.95f; - if (NPC.velocity.Y == 0) - { - WalkTimer++; - GeneralParticleHandler.SpawnParticle(new Particles.StoneDebrisParticle(Main.rand.NextVector2FromRectangle(NPC.getRect() with { Y = (int)NPC.Center.Y }), new Vector2(Main.rand.NextFloat(-6, 6), Main.rand.NextFloat(-6, -2)), Lighting.GetColor(NPC.Bottom.ToTileCoordinates()), Main.rand.NextFloat(0.5f, 1.2f), 10)); - } - if (WalkTimer % 10 == 0) - { - SoundEngine.PlaySound(SoundID.Dig, NPC.Center); - } - int startFall = 40; - if (WalkTimer >= startFall) - { - NPC.alpha += 5; - if (NPC.alpha > 255) - { - NPC.active = false; - } - } - } - break; - } - - if ((Phase != (int)PhaseType.FoundItem && Phase != (int)PhaseType.Burrow) && WalkTimer > 0) - WalkTimer--; - - if (TurnTimer > 0) - TurnTimer--; - - NPC.spriteDirection = NPC.direction; - } - - public void SpawnItem(int ID, float stackMult = 1f) - { - int stack = 1; - if (NPC.localAI[0] != NPC.localAI[1]) - { - stack = Main.rand.Next((int)NPC.localAI[0], (int)NPC.localAI[1] + 1); - } - stack = (int)(stack * stackMult); - int i = Item.NewItem(NPC.GetSource_FromThis(), new Rectangle((int)NPC.Center.X + NPC.direction * 20, (int)NPC.Center.Y - 20, NPC.width, NPC.height), ID, Stack: stack, noBroadcast: false); - Main.item[i].velocity = new Vector2(NPC.direction * Main.rand.NextFloat(3.7f, 4.3f), -Main.rand.NextFloat(-1.2f, 0.8f)); - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i); - } - } - - // Checks if the horizontal position in front of it has water or is a pit so that the crab can avoid it - public bool WaterCheck(int height) - { - Point startPos = NPC.direction == 1 ? NPC.Right.ToTileCoordinates() : NPC.Left.ToTileCoordinates(); - for (int i = 1; i < height; i++) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i); - Tile above = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i - 1); - // If there's a tile, wegud - if (t.HasTile) - return false; - // If there's liquid or a pit, we not gud - if (t.LiquidAmount > 0 && !above.HasTile) - return true; - - } - return true; - } - - // Checks if the horizontal position in front of the crab can be jumped up - public bool JumpCheck() - { - Point startPos = NPC.direction == 1 ? NPC.BottomRight.ToTileCoordinates() : NPC.BottomLeft.ToTileCoordinates(); - bool canJump = false; - int add = NPC.direction == 1 ? 0 : -1; - int jumpHeight = 6; - for (int i = jumpHeight; i > 0; i--) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + add, startPos.Y - i); - // If there are tiles obfuscating the jump position, return false - if (i > (jumpHeight - 2) && t.HasTile) - return false; - // If there is a tile to jump on, return true - if (t.HasTile) - { - canJump = true; - break; - } - } - return canJump; - } - - public int CalculateReward(out int min, out int max) - { - min = 0; - max = 0; - // Make sure the held item type is valid - if (ScavengerLoot.TryGetValue(HeldItemType, out WeightedRandom value)) - { - // If the held item has no roll value, immediately return - if (value == null) - return 0; - - int tries = 100; - for (int i = 0; i < tries; i++) - { - var v = value.Get(); - if (v.condition.Invoke()) - { - min = v.minimum; - max = v.maximum; - return v.itemID; - } - } - - return 0; - } - else - { - return 0; - } - } - - public static bool IsPassableTile(int x, int y) - { - return (!Main.tile[x, y].HasUnactuatedTile || - !Main.tileSolid[(int)Main.tile[x, y].TileType] || Main.tileSolidTop[(int)Main.tile[x, y].TileType]); - } - - public void StepUp() - { - Vector2 position = NPC.position; - position.X += NPC.velocity.X; - int x = (int)((position.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1)) * NPC.direction) / 16f); - int y = (int)((position.Y + (float)NPC.height - 1f) / 16f); - - if ((float)(x * 16) >= position.X + (float)NPC.width || (float)(x * 16 + 16) <= position.X) - return; - - bool nextTileValid = Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]; - bool aboveTileHalfBlock = Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile; - bool aboveTileHasRoom = Main.tile[x, y - 1].IsHalfBlock && IsPassableTile(x, y - 4); - bool aboveTileEmpty = !Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || aboveTileHasRoom; - bool tile3AbovePassable = !Main.tile[x - NPC.direction, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - NPC.direction, y - 3].TileType]; - - if ((nextTileValid || aboveTileHalfBlock) && aboveTileEmpty && IsPassableTile(x, y - 2) && IsPassableTile(x, y - 3) && tile3AbovePassable) - { - float npcBottom = (float)(y * 16); - if (Main.tile[x, y].IsHalfBlock) - { - npcBottom += 8f; - } - if (Main.tile[x, y - 1].IsHalfBlock) - { - npcBottom -= 8f; - } - if (npcBottom < position.Y + (float)NPC.height) - { - float percentageTileRisen = position.Y + (float)NPC.height - npcBottom; - if (percentageTileRisen <= 16.1f) - { - NPC.gfxOffY += NPC.position.Y + (float)NPC.height - npcBottom; - NPC.position.Y = npcBottom - (float)NPC.height; - if (percentageTileRisen < 9f) - { - NPC.stepSpeed = 1f; - } - else - { - NPC.stepSpeed = 2f; - } - } - } - } - } - - public override void FindFrame(int frameHeight) - { - float frameCount = Main.npcFrameCount[Type] - 1; - - if (ShouldUseWalkingFrames) - frameCount = 5; - else if (ShouldUseInspectionFrames) - frameCount = 23; - else if (ShouldUseGivingFrames) - frameCount = 12; - - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y++; - NPC.frameCounter = 0; - } - - // Reset frame when transitioning to giving animation - if (NPC.frame.Y >= frameCount || (Phase == (int)PhaseType.Bartering && TradeTimer == 80)) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.4f; - } - return 0f; - - //fuck this - //if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType()) - //{ - // return 0.05f; - //} - //return 0f; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - if (Phase != (int)PhaseType.Burrow) - { - WalkTimer = 0; - Phase = (int)PhaseType.Burrow; - foreach (NPC n in Main.ActiveNPCs) - { - if (n == NPC) - continue; - if (n.type != NPC.type) - continue; - if (n.Distance(NPC.Center) > 600) - continue; - Scavenger scav = n.ModNPC(); - scav.PlayerHurt(); - scav.WalkTimer += Main.rand.Next(-20, 10); - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 2; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, Color.DarkGray * 0.2f, 1f); - } - } - CalamityUtils.SpawnGores(NPC, "Scavenger", 3); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - int frameCount = Main.npcFrameCount[Type]; - float extraPosOffset = 0; - if (ShouldUseWalkingFrames) - { - texture = walkTexture.Value; - frameCount = 6; - } - else if (ShouldUseInspectionFrames) - { - texture = inspectTexture.Value; - frameCount = 24; - extraPosOffset = 6; - } - else if (ShouldUseGivingFrames) - { - texture = giveTexture.Value; - frameCount = 13; - } - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / frameCount / 2); - Vector2 npcOffset = NPC.Center - screenPos + Vector2.UnitY * extraPosOffset; - npcOffset -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - int burrowHide = 0; - if (Phase == (int)PhaseType.Burrow) - { - float comp = Utils.GetLerpValue(40, 120, WalkTimer, true); - burrowHide = (int)MathHelper.Lerp(0, texture.Height / frameCount + 1, comp); - npcOffset.Y += MathHelper.Lerp(0, NPC.height, comp); - } - Rectangle frame = texture.Frame(1, frameCount, 0, NPC.frame.Y); - spriteBatch.Draw(texture, npcOffset, frame with { Height = frame.Height - burrowHide }, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - // my dreams devoured - // legacy code for visually holding an item - /*Texture2D item = TextureAssets.Item[HeldItemType].Value; - Vector2 itemOffset = new Vector2(NPC.direction == 1 ? 8 : -8, 20); - if (TradeTimer < 80) - spriteBatch.Draw(item, npcOffset + itemOffset, null, drawColor, 0, new Vector2(item.Width / 2, item.Height), 1f, spriteEffects, 0); - */ - return false; - } - } -} diff --git a/NPCs/SunkenSea/Scavenger.png b/NPCs/SunkenSea/Scavenger.png deleted file mode 100644 index 7e3f646f0d..0000000000 Binary files a/NPCs/SunkenSea/Scavenger.png and /dev/null differ diff --git a/NPCs/SunkenSea/ScavengerGiving.png b/NPCs/SunkenSea/ScavengerGiving.png deleted file mode 100644 index cd08777d65..0000000000 Binary files a/NPCs/SunkenSea/ScavengerGiving.png and /dev/null differ diff --git a/NPCs/SunkenSea/ScavengerInspecting.png b/NPCs/SunkenSea/ScavengerInspecting.png deleted file mode 100644 index 7db93e9712..0000000000 Binary files a/NPCs/SunkenSea/ScavengerInspecting.png and /dev/null differ diff --git a/NPCs/SunkenSea/ScavengerWalking.png b/NPCs/SunkenSea/ScavengerWalking.png deleted file mode 100644 index 229cc451c6..0000000000 Binary files a/NPCs/SunkenSea/ScavengerWalking.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index aa8b778d62..5d1d30a8af 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -1,63 +1,44 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Critters; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class SeaFloaty : SunkenSeaNPC + public class SeaFloaty : ModNPC { private bool hasBeenHit = false; - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 5; + Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { - SpriteDirection = -1 + SpriteDirection = 1 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); } public override void SetDefaults() { - base.SetDefaults(); NPC.npcSlots = 0.5f; NPC.aiStyle = -1; AIType = -1; - NPC.damage = 0; - NPC.width = 44; + NPC.damage = 5; + NPC.width = 72; NPC.height = 22; NPC.defense = 0; - NPC.lifeMax = 5; + NPC.lifeMax = 50; NPC.knockBackResist = 0.5f; + NPC.value = Item.buyPrice(0, 0, 0, 50); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; Banner = NPC.type; BannerItem = ModContent.ItemType(); - NPC.catchItem = ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -82,18 +63,17 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - NPC.TargetClosest(false); if (NPC.velocity.X > 0.25f) - { - NPC.spriteDirection = 1; - } - else if (NPC.velocity.X < 0.25f) { NPC.spriteDirection = -1; } + else if (NPC.velocity.X < 0.25f) + { + NPC.spriteDirection = 1; + } if (NPC.ai[0] == 0f) { - NPC.direction = -1; + NPC.direction = 1; NPC.ai[0] = 1f; } NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; @@ -107,27 +87,12 @@ namespace CalamityMod.NPCs.SunkenSea NPC.direction *= -1; NPC.netUpdate = true; } - // panic when it gets hit or the player is close enough to it - if ((NPC.justHit || CurrentPlayer != null || CurrentPredator != null) && !hasBeenHit) + + if (NPC.justHit && !hasBeenHit) { hasBeenHit = true; NPC.noTileCollide = true; NPC.noGravity = true; - - SoundEngine.PlaySound(SoundID.NPCHit37 with { Pitch = 1 }, NPC.Center); - - if (!Main.dedServ) - { - var emoteDirection = -Vector2.UnitY * Main.rand.NextFloat(2f, 3f); - Particle emote = new EmoteExpressionParticle( - NPC.Center + emoteDirection * 2f, - emoteDirection, - 2.2f, - Color.Yellow, - Main.rand.Next(30, 46), - EmoteExpressionParticle.EmoteType.Exclamation); - GeneralParticleHandler.SpawnParticle(emote); - } } NPC.chaseable = hasBeenHit; if (hasBeenHit) @@ -164,29 +129,18 @@ namespace CalamityMod.NPCs.SunkenSea } } } - protected override bool NPCSearchFilter(NPC n) - { - return NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 360f * 360f && PredatorIDs.Contains(n.type); - } - - protected override bool PlayerSearchFilter(Player p) - { - return NPC.HasSight(p.Center) && Vector2.DistanceSquared(NPC.Center, p.Center) < 360f * 360f; - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); public override void FindFrame(int frameHeight) { NPC.frameCounter += hasBeenHit ? 0.3f : 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.CaveJellyfish.Chance * 0.45f; } @@ -205,8 +159,13 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore3").Type, 1f); + } } - CalamityUtils.SpawnGores(NPC, "SeaFloaty", 1); } } } diff --git a/NPCs/SunkenSea/SeaFloaty.png b/NPCs/SunkenSea/SeaFloaty.png index 1af90fa4cd..cb786ed41d 100644 Binary files a/NPCs/SunkenSea/SeaFloaty.png and b/NPCs/SunkenSea/SeaFloaty.png differ diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 7da60d1334..6f596ab8da 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -1,54 +1,32 @@ using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; +using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.Pathfinding; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class SeaMinnow : SunkenSeaNPC + public class SeaMinnow : ModNPC { - public Entity avoidedEntity; - - public Vector2 randomPathPoint; - protected override List PreyIDs => new List(); - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; - public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 8; - Main.npcCatchable[Type] = true; - NPCID.Sets.CountsAsCritter[Type] = true; - base.SetStaticDefaults(); + Main.npcFrameCount[NPC.type] = 4; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; } public override void SetDefaults() { - base.SetDefaults(); - NPC.npcSlots = 0f; + NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.damage = 0; - NPC.width = 32; - NPC.height = 26; + NPC.width = 36; + NPC.height = 22; NPC.defense = 0; NPC.lifeMax = 5; NPC.aiStyle = -1; @@ -59,6 +37,7 @@ namespace CalamityMod.NPCs.SunkenSea BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -69,286 +48,117 @@ namespace CalamityMod.NPCs.SunkenSea }); } - public override void OnSpawn(IEntitySource source) - { - NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); - } public override void AI() { - if (pathfinding == null) + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + bool shouldSwimAway = false; + if (NPC.direction == 0) { - pathfinding = new PathfindingManager(this); - Acceleration = 0.6f; - MaxSpeed = 5f; + NPC.TargetClosest(true); } - NPC owner = Main.npc[(int)NPC.ai[2]]; if (NPC.wet) { - if (owner == null || !owner.active || (owner.type != ModContent.NPCType() && owner.type != ModContent.NPCType())) + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) { - if (CurrentPredator == null) + shouldSwimAway = true; + } + if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) + { + shouldSwimAway = false; + } + if (!shouldSwimAway) + { + if (NPC.collideX || NPC.velocity.X == 0f) { - CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); - NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; - NPC.noGravity = true; - bool shouldSwimAway = false; - if (NPC.direction == 0) + NPC.velocity.X = NPC.velocity.X * -3f; + NPC.direction *= -1; + NPC.netUpdate = true; + } + if (NPC.collideY) + { + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) { - NPC.TargetClosest(true); + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; + NPC.directionY = -1; + NPC.ai[0] = -1f; } - NPC.TargetClosest(false); - if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && - (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) + else if (NPC.velocity.Y < 0f) { - shouldSwimAway = true; - } - if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) - { - shouldSwimAway = false; - } - if (!shouldSwimAway) - { - if (NPC.collideX || NPC.velocity.X == 0f) - { - NPC.velocity.X = NPC.velocity.X * -3f; - NPC.direction *= -1; - NPC.netUpdate = true; - } - if (NPC.collideY) - { - NPC.netUpdate = true; - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; - NPC.directionY = -1; - NPC.ai[0] = -1f; - } - else if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y); - NPC.directionY = 1; - NPC.ai[0] = 1f; - } - } - } - if (shouldSwimAway) - { - NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; - NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; - if (NPC.velocity.X > 6f) - { - NPC.velocity.X = 6f; - } - if (NPC.velocity.X < -6f) - { - NPC.velocity.X = -6f; - } - if (NPC.velocity.Y > 6f) - { - NPC.velocity.Y = 6f; - } - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - NPC.direction *= -1; - } - else - { - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; - if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) - { - NPC.velocity.X = NPC.velocity.X * 0.95f; - } - if (NPC.ai[0] == -1f) - { - NPC.velocity.Y = NPC.velocity.Y - 0.01f; - if ((double)NPC.velocity.Y < -0.3) - { - NPC.ai[0] = 1f; - } - } - else - { - NPC.velocity.Y = NPC.velocity.Y + 0.01f; - if ((double)NPC.velocity.Y > 0.3) - { - NPC.ai[0] = -1f; - } - } - } - int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; - int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; - if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) - { - if (Main.tile[npcTileX, npcTileY + 1].HasTile) - { - NPC.ai[0] = -1f; - } - else if (Main.tile[npcTileX, npcTileY + 2].HasTile) - { - NPC.ai[0] = -1f; - } - } - if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) - { - NPC.velocity.Y = NPC.velocity.Y * 0.95f; + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; } } - else + } + if (shouldSwimAway) + { + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; + NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; + if (NPC.velocity.X > 6f) { - // Check who is the avoided entity specifically. - avoidedEntity = avoidedEntity is NPC ? CurrentPredator : CurrentPlayer; - - if (avoidedEntity is not null) - { - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(avoidedEntity.Center) * 96).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(avoidedEntity.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, avoidedEntity.Center); - randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, randomPathPoint, SunkenSeaTileValidity)); - } - } - else - { - pathfinding.DoPathfinding(new(this, NPC.Center, Main.rand.NextVector2Unit() * Main.rand.Next(300, 1000), SunkenSeaTileValidity)); - } + NPC.velocity.X = 6f; } + if (NPC.velocity.X < -6f) + { + NPC.velocity.X = -6f; + } + if (NPC.velocity.Y > 6f) + { + NPC.velocity.Y = 6f; + } + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } + NPC.direction *= -1; } else { - if (!owner.active) - return; - - if (NPC.Distance(owner.Center) > 200) - pathfinding.DoPathfinding(new(this, NPC.Center, owner.Center, SunkenSeaTileValidity)); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) + { + NPC.velocity.X = NPC.velocity.X * 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) + { + NPC.ai[0] = 1f; + } + } else { - float passiveMvtFloat = 0.5f; - float range = 100f; - Vector2 fischPos = NPC.Center; - float xDist = owner.Center.X - fischPos.X; - float yDist = owner.Center.Y - fischPos.Y; - yDist += Main.rand.NextFloat(-10, 20); - xDist += Main.rand.NextFloat(-10, 20); - xDist += 30f * -(float)owner.direction; - Vector2 leaderVector = new Vector2(xDist, yDist); - float leaderDist = leaderVector.Length(); - float returnSpeed = 8f; - //If leader is close enough, resume normal - if (leaderDist < range && owner.velocity.Y == 0f && - NPC.Bottom.Y <= owner.Bottom.Y && - !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) { - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - } - - if (leaderDist < 50f) - { - if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) - { - NPC.velocity *= 0.99f; - } - passiveMvtFloat = 0.01f; - } - else - { - if (leaderDist < 100f) - { - passiveMvtFloat = 0.1f; - } - if (leaderDist > 300f) - { - passiveMvtFloat = 1f; - } - leaderDist = returnSpeed / leaderDist; - leaderVector.X *= leaderDist; - leaderVector.Y *= leaderDist; - } - if (NPC.velocity.X < leaderVector.X) - { - NPC.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) - { - NPC.velocity.X += passiveMvtFloat; - } - } - if (NPC.velocity.X > leaderVector.X) - { - NPC.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) - { - NPC.velocity.X -= passiveMvtFloat; - } - } - if (NPC.velocity.Y < leaderVector.Y) - { - NPC.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) - { - NPC.velocity.Y += passiveMvtFloat * 2f; - } - } - if (NPC.velocity.Y > leaderVector.Y) - { - NPC.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) - { - NPC.velocity.Y -= passiveMvtFloat * 2f; - } - } - if (NPC.velocity.X >= 0.25f) - { - NPC.direction = -1; - } - else if (NPC.velocity.X < -0.25f) - { - NPC.direction = 1; - } - NPC.spriteDirection = -NPC.direction; - } - float SAImovement = 0.2f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherFish = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherFish.active || k == NPC.whoAmI || (otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType())) - continue; - - float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width) - { - if (NPC.position.X < otherFish.position.X) - NPC.velocity.X -= SAImovement; - else - NPC.velocity.X += SAImovement; - - if (NPC.position.Y < otherFish.position.Y) - NPC.velocity.Y -= SAImovement; - else - NPC.velocity.Y += SAImovement; + NPC.ai[0] = -1f; } } } - int dir = NPC.velocity.X.DirectionalSign(); - NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); - NPC.spriteDirection = NPC.direction = dir; + int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; + if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) + { + if (Main.tile[npcTileX, npcTileY + 1].HasTile) + { + NPC.ai[0] = -1f; + } + else if (Main.tile[npcTileX, npcTileY + 2].HasTile) + { + NPC.ai[0] = -1f; + } + } + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) + { + NPC.velocity.Y = NPC.velocity.Y * 0.95f; + } } else { @@ -365,11 +175,17 @@ namespace CalamityMod.NPCs.SunkenSea { NPC.velocity.Y = 10f; } + NPC.ai[0] = 1f; } - - if (NPC.type == ModContent.NPCType()) + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) { - NPC.ProduceGoldCritterDust(); + NPC.rotation = -0.1f; + } + if ((double)NPC.rotation > 0.1) + { + NPC.rotation = 0.1f; + return; } } @@ -380,54 +196,27 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; return; } - NPC.frameCounter += 0.15f; - NPC.frameCounter %= Main.npcFrameCount[Type]; + NPC.frameCounter += 0.075f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - CalamityUtils.SpawnGores(NPC, "SeaMinnow", 2); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - randomPathPoint = reader.ReadVector2(); - } - } - public class SeaMinnowGold : SeaMinnow - { - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.catchItem = (short)ModContent.ItemType(); - NPC.rarity = 3; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/SunkenSea/SeaMinnow.png b/NPCs/SunkenSea/SeaMinnow.png index 4baf632a28..456d61faab 100644 Binary files a/NPCs/SunkenSea/SeaMinnow.png and b/NPCs/SunkenSea/SeaMinnow.png differ diff --git a/NPCs/SunkenSea/SeaMinnowGold.png b/NPCs/SunkenSea/SeaMinnowGold.png deleted file mode 100644 index f070775305..0000000000 Binary files a/NPCs/SunkenSea/SeaMinnowGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs new file mode 100644 index 0000000000..9b363aaab3 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -0,0 +1,360 @@ +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent1 : ModNPC + { + public const int maxLength = 9; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 + }; + value.Position.Y += 20; + value.Position.X += 40; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 50; //42 + NPC.height = 24; //32 + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + + public override void AI() + { + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; + if (createDust) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 0.3f / 255f, (255 - NPC.alpha) * 0.3f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + NPC.TargetClosest(true); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int lol = 0; + if (segment == 0 || segment == 1 || segment == 4 || segment == 5) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 2 || segment == 3 || segment == 6) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 7) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 8) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + + TailSpawned = true; + } + } + + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (Main.player[NPC.target].dead) + NPC.TargetClosest(false); + + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + { + NPC.TargetClosest(false); + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + NPC.active = false; + } + + float currentSpeed = speed; + float currentTurnSpeed = turnSpeed; + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + if (NPC.life > NPC.lifeMax * 0.99) + { + targetYDist += 300; + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) + { + if (NPC.velocity.X > 0f) + { + targetXDist = Main.player[NPC.target].Center.X + 300f; + } + else + { + targetXDist = Main.player[NPC.target].Center.X - 300f; + } + } + } + else + { + currentSpeed *= 1.5f; + currentTurnSpeed *= 1.5f; + } + float maxCurrentSpeed = currentSpeed * 1.3f; + float minCurrentSpeed = currentSpeed * 0.7f; + float speedCompare = NPC.velocity.Length(); + if (speedCompare > 0f) + { + if (speedCompare > maxCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxCurrentSpeed; + } + else if (speedCompare < minCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= minCurrentSpeed; + } + } + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float absoluteTargetX = System.Math.Abs(targetXDist); + float absoluteTargetY = System.Math.Abs(targetYDist); + float timeToReachTarget = currentSpeed / targetDistance; + targetXDist *= timeToReachTarget; + targetYDist *= timeToReachTarget; + if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; + } + } + if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 + } + } + } + else + { + if (absoluteTargetX > absoluteTargetY) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 + } + else if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + } + else + { + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; + } + else if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + } + } + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + { + Texture2D texture = TextureAssets.Npc[Type].Value; + Texture2D[] bodyTextures = [ + TextureAssets.Npc[ModContent.NPCType()].Value, + TextureAssets.Npc[ModContent.NPCType()].Value, + TextureAssets.Npc[ModContent.NPCType()].Value, + TextureAssets.Npc[ModContent.NPCType()].Value + ]; + + // Reimplementation of CalamityUtils.DrawAnimatedBestiaryWorm but tweaked due to body texture logic + NPC.frame = texture.Frame(); + // Buffers the segment position and rotations + float offset = -0.2f; + float rotationStrength = 0.3f; + int segmentSpacing = 22; + int animationSpeed = 2; + float range = 10; + float wormTimer = NPC.Calamity().bestiaryWormTimer; + // Draw the body segments + for (int i = 6; i > 0; i--) + { + // The first segment is slightly closer to keep up with the head + float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; + + // Body segment logic here genuinely sucks because of each texture being programmed as separate NPC types, this directly copies body spawning logic + Texture2D toUse = (i == 2 || i == 3) ? bodyTextures[1] : bodyTextures[0]; + spriteBatch.Draw(toUse, NPC.position + new Vector2(bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * range), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * rotationStrength, toUse.Size() / 2, NPC.scale, SpriteEffects.None, 0f); + } + // Draw the head + spriteBatch.Draw(texture, NPC.position + new Vector2(0f, MathF.Sin(wormTimer * animationSpeed) * range), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * rotationStrength, new Vector2(texture.Width * 0.5f, texture.Height), NPC.scale, SpriteEffects.None, 0f); + + return false; + } + + return true; + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SeaSerpent1.png new file mode 100644 index 0000000000..0e144e18e2 Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent1.png differ diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs new file mode 100644 index 0000000000..4da1f8d931 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -0,0 +1,147 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent2 : ModNPC + { + public float speed = 6f; + public float turnSpeed = 0.125f; + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore2").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent2.png b/NPCs/SunkenSea/SeaSerpent2.png new file mode 100644 index 0000000000..bdb5c315db Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent2.png differ diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs new file mode 100644 index 0000000000..aac96e6412 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent3 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 40; + NPC.width = 24; //42 + NPC.height = 16; //24 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore3").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent3.png b/NPCs/SunkenSea/SeaSerpent3.png new file mode 100644 index 0000000000..3ca49fc95e Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent3.png differ diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs new file mode 100644 index 0000000000..5f215471e2 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent4 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 30; + NPC.width = 28; //42 + NPC.height = 24; //34 + NPC.defense = 20; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent4.png b/NPCs/SunkenSea/SeaSerpent4.png new file mode 100644 index 0000000000..5625d8cf2d Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent4.png differ diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs new file mode 100644 index 0000000000..6549cf604f --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -0,0 +1,145 @@ +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent5 : ModNPC + { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + NPC.damage = 20; + NPC.width = 36; //42 + NPC.height = 30; //40 + NPC.defense = 30; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; //new + AIType = -1; //new + NPC.knockBackResist = 0f; + NPC.alpha = 255; + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + NPC.dontCountMe = true; + NPC.chaseable = false; + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } + + public override void AI() + { + // Avoid cheap bullshit + NPC.damage = 0; + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override bool CheckActive() + { + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore5").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SeaSerpent5.png new file mode 100644 index 0000000000..2772709ecb Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent5.png differ diff --git a/NPCs/SunkenSea/Searslug.cs b/NPCs/SunkenSea/Searslug.cs deleted file mode 100644 index e90e0ec8cd..0000000000 --- a/NPCs/SunkenSea/Searslug.cs +++ /dev/null @@ -1,195 +0,0 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.DataStructures; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Particles; -using ReLogic.Content; -using CalamityMod.Enums; -using System.Collections.Generic; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Searslug : SunkenSeaNPC - { - public bool Skinwalker => NPC.Calamity()?.newAI[0] == 1; - public static Asset glowTexture; - - public override void Load() => glowTexture = ModContent.Request(Texture + "Glow"); - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; - - protected override List PreyIDs => new(); - - protected override List PredatorIDs => new() - { - ModContent.NPCType() - }; - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 7; - } - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = NPCAIStyleID.Snail; - NPC.damage = 0; - NPC.width = 56; - NPC.height = 42; - NPC.defense = 0; - NPC.lifeMax = 20; - NPC.knockBackResist = 0f; - NPC.lavaImmune = true; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.GravityIgnoresLiquid = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.catchItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToWater = true; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 2; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 2; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Searslug") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // 1 in 10 chance to be a skinwalker - NPC.Calamity().newAI[0] = Main.rand.NextBool(10).ToInt(); - } - - public override void AI() - { - NPC.Calamity().newAI[1]++; - NPC.TargetClosest(false); - Lighting.AddLight(NPC.Center, 1, 0, 0); - if (Skinwalker) - { - // Randomly stutter - if (Main.rand.NextBool(300) && NPC.velocity.Y == 0) - NPC.velocity.X *= 0.7f; - - // If the player gets close enough, burst out and KILL the host - if (NPC.HasPlayerTarget && NPC.Calamity().newAI[1] > 120) - { - Player p = Main.player[NPC.target]; - if (p != null && p.active && p.Distance(NPC.Center) < 120 && Collision.CanHitLine(NPC.Center, 1, 1, p.Center, 1, 1)) - { - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = 0.8f, Volume = 0.6f }, NPC.Center); - SoundEngine.PlaySound(SoundID.NPCDeath1 with { Pitch = 0.4f }, NPC.Center); - for (int i = 0; i < 10; i++) - { - int size = 12; - Vector2 position = NPC.Center; - Vector2 velocity = Main.rand.NextVector2Circular(size, size); - SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.2f, 0.3f), Color.Orange, Main.rand.Next(5, 8), 1, 1.5f); - GeneralParticleHandler.SpawnParticle(energy); - Dust dust = Dust.NewDustPerfect(position, DustID.Torch, velocity, 0, default, Main.rand.NextFloat(1f, 1.6f)); - dust.noGravity = true; - } - NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); - NPC.HitEffect(); - NPC.active = false; - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - int frameGate = Skinwalker ? 8 : 6; - if (NPC.frameCounter > frameGate) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; - } - } - } - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneBasaltGully && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.2f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LavaMoss, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "Searslug", 2); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY - (Vector2.UnitY * 10).RotatedBy(NPC.rotation); - float colorMult = 1f; - // Shake if a skinwalker - if (Skinwalker) - { - pos += Main.rand.NextVector2Unit() * Main.rand.NextFloat(-1f, 1f); - colorMult = 0.8f; - } - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - spriteBatch.Draw(glowTexture.Value, pos, NPC.frame, Color.White * colorMult, NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - return false; - } - - public override bool? CanBeCaughtBy(Item item, Player player) - { - return ItemID.Sets.LavaproofCatchingTool[item.type]; - } - - public override void OnCaughtBy(Player player, Item item, bool failed) - { - // Wear protection! - if (failed) - { - player.AddBuff(BuffID.OnFire, CalamityUtils.SecondsToFrames(5)); - } - } - } -} diff --git a/NPCs/SunkenSea/Searslug.png b/NPCs/SunkenSea/Searslug.png deleted file mode 100644 index 05aa97f86b..0000000000 Binary files a/NPCs/SunkenSea/Searslug.png and /dev/null differ diff --git a/NPCs/SunkenSea/SearslugGlow.png b/NPCs/SunkenSea/SearslugGlow.png deleted file mode 100644 index 76f3ef5dd1..0000000000 Binary files a/NPCs/SunkenSea/SearslugGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs deleted file mode 100644 index 08c54d3e58..0000000000 --- a/NPCs/SunkenSea/Sharkoon.cs +++ /dev/null @@ -1,602 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Pathfinding; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Sharkoon : SunkenSeaNPC - { - #region Fields & Properties - - #region Static Fields - - //public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 200; - public static int IdleMaxPathDistance = 400; - - public static int FleeTileAnticipationDistance = 64; - - public static int ExplosionDistance = 80; - public static int ExplosionRadius = 80; - public static int ExplosionCooldown = 600; - public static int RecoveringTime = 120; - - #endregion - - /// - /// The different types of animation this enemy can have. - /// - private enum AnimationState { Normal, Explosion, Shrunk } - - /// - /// The current animation being played right now. - /// - private AnimationState Animation - { - get => (AnimationState)NPC.ai[1]; - set - { - // In case an animation is being set constantly, - // so we don't have it reset to the first frame every time, - // it'll only reset the current frame when actually changing animations. - if (value != Animation) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - NPC.ai[1] = (float)value; - - switch (value) - { - case AnimationState.Normal: - ChangeAnimation(animationFrames: 7, timePerAnimationFrame: 7, loops: true); - break; - case AnimationState.Explosion: - ChangeAnimation(animationFrames: 16, timePerAnimationFrame: 8, loops: false); - break; - case AnimationState.Shrunk: - ChangeAnimation(animationFrames: 6, timePerAnimationFrame: 6, loops: true); - break; - } - } - } - - /// - /// The amount of frames that one column of sprites has.
- /// Defaults to 7 since that's the first column's amount of frames. - ///
- private int _animationFrames = 7; - - /// - /// The amount, in frames, that it takes to go to the next animation frame.
- /// Defaults to 7. - ///
- private int _timePerAnimationFrame = 7; - - /// - /// Whether or not the animation loops or not.
- /// Defaults to . - ///
- private bool _animationLoop = true; - - /// - /// The squish of this NPC while drawing. - /// - private Vector2 ScaleSquish = Vector2.One; - - private Entity _avoidedEntity; - - /// - /// A timer used to know when the NPC should recover after it explodes. - /// - private ref float RecoverTimer => ref NPC.ai[2]; - - /// - /// Whether or not the Sharkoon is capable of exploding. - /// - private bool CanExplode => Animation == AnimationState.Normal; - - /// - /// Whether or not the Sharkoon is currently exploding. - /// - private bool IsExploding => CurrentBehavior == ExplodingBehavior; - - private Action _currentBehavior; - private Action CurrentBehavior - { - get => _currentBehavior; - set - { - if (value != _currentBehavior) - OnBehaviorChange(value); - _previousBehavior = _currentBehavior; - _currentBehavior = value; - } - } - - private Action _previousBehavior; - - private int HuntCooldown - { - get => (int)NPC.ai[3]; - set => NPC.ai[3] = value; - } - - #region SunkenSeaNPC Implementation - - protected override List PreyIDs => - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - ]; - - protected override List PredatorIDs => - [ - NPCType(), - // NPCType(), - NPCType(), - // NPCType, - ]; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs; - - #endregion - - #endregion - - #region SetDefaults - - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 16; - } - - public override void SetDefaults() - { - base.SetDefaults(); - - BannerItem = ItemType(); - - NPC.damage = 20; - NPC.lifeMax = 350; - NPC.defense = 5; - NPC.knockBackResist = 0.15f; - NPC.chaseable = false; - - NPC.width = 52; - NPC.height = 46; - NPC.noGravity = true; - - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(silver: 5); - - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - #endregion - - #region Behavior - - protected override bool PlayerSearchFilter(Player p) - { - return base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 960f * 960f; - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || (n == CurrentPrey || n == CurrentPredator) && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.3f; - MaxSpeed = 6f; - CurrentBehavior = IdlingBehavior; - NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); - NPC.GravityMultiplier *= 2f; - NPC.MaxFallSpeedMultiplier *= 2f; - } - - public override void AI() - { - if (pathfinding == null) - { - pathfinding = new PathfindingManager(this); - Acceleration = 0.3f; - MaxSpeed = 6f; - } - CurrentBehavior?.Invoke(); - - // Leans the Sharkoon towards the direction it's going. - NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); - NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); - - // When it has already exploded, a timer will start, which when finished it'll make the Sharkoon recover. - if (!CanExplode) - { - RecoverTimer++; - if (RecoverTimer > ExplosionCooldown) - CurrentBehavior = RecoveringBehavior; - } - - // When it gets outside of water, it'll try to gravitate downards towards the water. - if (!NPC.wet && !IsExploding && CurrentBehavior != OutsideWaterBehavior) - CurrentBehavior = OutsideWaterBehavior; - - - // Reset any squish that is done to the Sharkoon, and clamps its upper limit to prevent it from becoming too tall - if (ScaleSquish.Y > 1f) - ScaleSquish.Y = MathHelper.Clamp(ScaleSquish.Y, 1f, 1.5f); - ScaleSquish.Y = Math.Max(1f, ScaleSquish.Y - 0.025f); - } - - private void IdlingBehavior() - { - // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(this, NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); - } - - private void HuntingBehavior() - { - // If there's no more prey, go back to idling. - if (CurrentPrey is null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - bool huntReady = HuntCooldown == 0; - if (huntReady) - HuntCooldown = Main.rand.Next(13, 30); - - // With sight, just go straight at him. Without it, try to pathfind over them. - pathfinding.DoPathfinding(new(this, NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity), forceNewTask: huntReady); - - HuntCooldown--; - } - - private void FleeingBehavior() - { - // Check who is the avoided entity specifically. - _avoidedEntity = _avoidedEntity is NPC ? CurrentPredator : CurrentPlayer; - - // If the avoided entity is gone, go back to idling. - if (_avoidedEntity == null) - { - CurrentBehavior = IdlingBehavior; - return; - } - - // While it doesn't have any obstacles in front of it, run away in a straight line. - // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(_avoidedEntity.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) - { - NPC.velocity += NPC.DirectionFrom(_avoidedEntity.Center) * Acceleration; - pathfinding.ClearResults(); - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - { - float distanceFromAvoided = Vector2.Distance(NPC.Center, _avoidedEntity.Center); - _randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); - NPC.netUpdate = true; - pathfinding.DoPathfinding(new(this, NPC.Center, _randomPathPoint, SunkenSeaTileValidity)); - } - - // If it's capable of exploding and the predator's within distance, kaboom. - if (CanExplode && NPC.DistanceSQ(_avoidedEntity.Center) < ExplosionDistance * ExplosionDistance && _avoidedEntity is NPC predator && PredatorIDs.Contains(predator.type)) - CurrentBehavior = ExplodingBehavior; - } - - private void ExplodingBehavior() - { - // Deaccelerate. - NPC.velocity *= 0.95f; - - // Produces light while exploding. - Lighting.AddLight(NPC.Center, Color.Orange.ToVector3() * Utils.GetLerpValue(NPC.height, NPC.height * 9, NPC.frame.Y, true)); - - // On the exact frame that the NPC explodes, it'll will, indeed, explode. - if (NPC.frame.Y == NPC.height * 9 && NPC.frameCounter == 0) - Kaboom(); - - // When the animation's finished, go back to being a normal fish. - if (NPC.frame.Y >= NPC.height * 16) - { - Animation = AnimationState.Shrunk; - CurrentBehavior = _previousBehavior; - } - } - - private void RecoveringBehavior() - { - if (RecoverTimer >= RecoveringTime) - { - Animation = AnimationState.Normal; - CurrentBehavior = _previousBehavior; - } - - // Deaccelerates to stay still. - NPC.velocity *= 0.95f; - - // VFX and sound effects go here, - // a dedicated server doesn't need to load these. - if (!Main.dedServ) - { - float fade = Utils.GetLerpValue(RecoveringTime, 0, RecoverTimer); - if (Main.rand.NextBool()) - { - Vector2 velOffset = RandomVelocity(50f, 20f, 70f, 0.04f); - velOffset *= Main.rand.NextFloat(15, 20) * fade; - Dust dust = Dust.NewDustPerfect(NPC.Center + velOffset * 2.5f, DustID.RainbowMk2, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.8f, 0.95f)); - dust.noGravity = true; - dust.color = Color.Aqua; - } - } - - RecoverTimer++; - } - - private void OutsideWaterBehavior() - { - if (NPC.wet) - { - NPC.noGravity = true; - CurrentBehavior = _previousBehavior; - } - } - - private void OnBehaviorChange(Action newBehavior) - { - // Obviously, when it gets to the exploding behaivor, it should make the explosion animation. - if (newBehavior == ExplodingBehavior) - Animation = AnimationState.Explosion; - - // Resets the timer when it needs to use it again. - if (newBehavior == RecoveringBehavior || CurrentBehavior == RecoveringBehavior) - RecoverTimer = 0f; - - // When it gets outside of water, it'll try to gravitate downards towards the water. - if (newBehavior == OutsideWaterBehavior) - NPC.noGravity = false; - - MinimumPointDistance = newBehavior == HuntingBehavior ? 20f : 48f; - } - - protected override void OnPreyDetection(NPC prey) - { - // If it's not a small fish and it's not being chased by a predator, the Sharkoon may hunt. - if (CanExplode && CurrentPredator is null && !IsExploding) - { - CurrentBehavior = HuntingBehavior; - ScaleSquish.Y += 0.4f; - } - } - - protected override void OnPredatorDetection(NPC predator) - { - // If it detects a predator, time to run. - if (!IsExploding) - { - CurrentBehavior = FleeingBehavior; - _avoidedEntity = predator; - ScaleSquish.Y += 0.4f; - } - } - - protected override void OnPlayerDetection(Player player) - { - // When there's a predator, player's shouldn't matter. - if (CurrentPredator is not null && !IsExploding) - return; - - CurrentBehavior = FleeingBehavior; - _avoidedEntity = player; - ScaleSquish.Y += 0.4f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 25; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - if (CanExplode) - { - SpawnGores(NPC, "Sharkoon", 6); - } - else - { - SpawnGores(NPC, "SharkoonSmall", 2); - } - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); - - public override void OnHitByNPC(NPC attacker) - { - if (CanExplode) - CurrentBehavior = ExplodingBehavior; - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - if (CanExplode) - CurrentBehavior = ExplodingBehavior; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - if (CanExplode) - CurrentBehavior = ExplodingBehavior; - } - - private void Kaboom() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile( - NPC.GetSource_FromThis(), - NPC.Center, - Vector2.Zero, - ProjectileType(), - NPC.damage * 10, - 10f, - ai0: NPC.whoAmI); - } - - AddScreenshakeAt(NPC.Center, 15f); - - // VFX and sound effects go here, - // a dedicated server doesn't need to load these. - if (!Main.dedServ) - { - for (int i = 0; i < 10; i++) - { - Dust dust = Dust.NewDustPerfect(NPC.Center, DustID.FireworksRGB, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); - dust.noGravity = false; - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; - } - for (int i = 0; i < 18; i++) - { - Dust dust = Dust.NewDustPerfect(NPC.Center, DustID.RainbowMk2, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); - dust.noGravity = true; - dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; - } - for (int i = 0; i < 8; i++) - { - Vector2 randVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); - Particle smoke = new HeavySmokeParticle(NPC.Center + randVel, randVel, Color.Lerp(Color.SlateGray, Color.Black, Main.rand.NextFloat(0.2f, 0.45f)), Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); - GeneralParticleHandler.SpawnParticle(smoke); - } - SoundStyle boom = new("CalamityMod/Sounds/Custom/SharkoonBoom"); - SoundEngine.PlaySound(boom with { Volume = 0.7f, PitchVariance = 0.15f }, NPC.Center); - } - } - - public override void AwaitingPathBehavior() - { - if (CurrentBehavior == HuntingBehavior) - { - if (CurrentPrey != null) - { - NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * Acceleration; - - // Cap the speed if MaxSpeed has been surpassed. - if (NPC.velocity.LengthSquared() > MaxSpeed * MaxSpeed) - NPC.velocity = Vector2.Normalize(NPC.velocity) * MaxSpeed; - } - else - NPC.velocity *= 0.95f; - } - else - base.AwaitingPathBehavior(); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.2f; - } - return 0f; - } - - #endregion - - #region Drawing & Animation - - /// - /// A quick method to change all the animation's properties. - /// - private void ChangeAnimation(int animationFrames, int timePerAnimationFrame, bool loops) - { - _animationFrames = animationFrames; - _timePerAnimationFrame = timePerAnimationFrame; - _animationLoop = loops; - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > _timePerAnimationFrame) - { - NPC.frame.Y += frameHeight; - NPC.frame.Y = Math.Min(NPC.frame.Y, _animationFrames * frameHeight); - NPC.frameCounter = 0; - if (_animationLoop) - NPC.frame.Y = NPC.frame.Y % (_animationFrames * frameHeight); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 drawPosition = NPC.Center - screenPos; - Rectangle frame = texture.Frame(horizontalFrames: 3, verticalFrames: 16, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); - Vector2 anchorPoint = frame.Size() * 0.5f; - SpriteEffects flip = NPC.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); - - return false; - } - - #endregion - - #region Sycning - - private Vector2 _randomPathPoint; - - public override void SendExtraAI(BinaryWriter writer) - { - writer.WriteVector2(_randomPathPoint); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - _randomPathPoint = reader.ReadVector2(); - } - - #endregion - } -} diff --git a/NPCs/SunkenSea/Sharkoon.png b/NPCs/SunkenSea/Sharkoon.png deleted file mode 100644 index 44b0698b16..0000000000 Binary files a/NPCs/SunkenSea/Sharkoon.png and /dev/null differ diff --git a/NPCs/SunkenSea/Shoreskipper.cs b/NPCs/SunkenSea/Shoreskipper.cs deleted file mode 100644 index 6a63d540ff..0000000000 --- a/NPCs/SunkenSea/Shoreskipper.cs +++ /dev/null @@ -1,466 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using CalamityMod.Enums; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Enemy; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader.Utilities; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Critters; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Shoreskipper : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Roar = 1, - Jumps = 2, - } - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - public bool spawnedTackleHitbox = false; - public bool notLandedFromWater = false; // When in water or just got out of water but not yet landed on solid ground - public NPC Target; // Chosen target (can only be other shoreskippers) - - #region SunkenSea Fields - protected override List PreyIDs => - [ - NPCType(), - ]; - protected override List PredatorIDs => - [ - NPCType(), - ]; - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.TimelessShores; - - protected override bool NPCSearchFilter(NPC n) - { - // Only consider same-type NPCs within 450 pixels - return n.active && n.type == Type && Vector2.DistanceSquared(NPC.Center, n.Center) < 450f * 450f; - } - protected override void OnPreyDetection(NPC prey) - { - if (prey.active && NPC.HasSight(prey.Center) && (Target == null || !Target.active)) - { - ChangePhase((int)PhaseType.Roar); - Target = prey; - } - } - #endregion - - - public override bool CanBeHitByNPC(NPC attacker) => true; - public override bool CanHitNPC(NPC target) => target.type == NPC.type; - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override bool? CanBeHitByItem(Player player, Item item) => true; - public override bool? CanBeHitByProjectile(Projectile projectile) => true; - - // If not a Shoreskipper tackle, nullify knockback - public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) - { - if (projectile.type != ProjectileType()) - projectile.knockBack = 0f; - } - public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) => modifiers.DisableKnockback(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.DisableKnockback(); - - #region Syncing - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.ai[0]); - writer.Write(NPC.ai[1]); - writer.Write(NPC.ai[2]); - writer.Write(NPC.ai[3]); - writer.Write(NPC.Calamity().newAI[0]); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(spawnedTackleHitbox); - writer.Write(notLandedFromWater); - - int targetWhoAmI = Target == null || !Target.active ? -1 : Target.whoAmI; - writer.Write(targetWhoAmI); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.ai[0] = reader.ReadSingle(); - NPC.ai[1] = reader.ReadSingle(); - NPC.ai[2] = reader.ReadSingle(); - NPC.ai[3] = reader.ReadSingle(); - NPC.Calamity().newAI[0] = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - spawnedTackleHitbox = reader.ReadBoolean(); - notLandedFromWater = reader.ReadBoolean(); - - int targetWhoAmI = reader.ReadInt32(); - if (targetWhoAmI >= 0 && targetWhoAmI < Main.maxNPCs) - Target = Main.npc[targetWhoAmI]; - else - Target = null; - } - #endregion - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 7; - Main.npcCatchable[Type] = true; - } - - public override void SetDefaults() - { - NPC.aiStyle = -1; - NPC.damage = 15; - NPC.width = 64; - NPC.height = 32; - NPC.defense = 4; - NPC.lifeMax = 80; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath9; - NPC.GravityIgnoresLiquid = true; - - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - - NPC.catchItem = (short)ModContent.ItemType(); - - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = false; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToWater = false; - - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Shoreskipper") - }); - } - public override bool? CanFallThroughPlatforms() - { - // Fall to try to reach target - if (CurrentPhase == (int)PhaseType.Jumps && Target.Top.Y > NPC.Bottom.Y) - return true; - - return false; - } - - private bool HasActiveTackle() // Check for if their melee hitbox exists as to not spawn multiple at once - { - int tackleType = ProjectileType(); - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile proj = Main.projectile[i]; - if (proj.active && proj.type == tackleType && proj.ai[0] == NPC.whoAmI) - return true; - } - return false; - } - - public override void AI() - { - NPC.Calamity().newAI[1]++; // Mark as out of water - NPC.TargetClosest(false); - - if (NPC.direction == 0) - { - NPC.direction = Main.rand.NextBool().ToDirectionInt(); - } - int frameHeight = TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]; - - - if (NPC.velocity.Y == 0 && NPC.oldVelocity.Y != 0f && notLandedFromWater && !NPC.wet) // Do not maintain velocity from skipping on water - { - NPC.velocity.X = 0f; - notLandedFromWater = false; - } - - if (notLandedFromWater && !NPC.wet && NPC.velocity.Length() > 6.5f && Timer % 4 == 0) // When skipping on water at high enough velocity, spawns trailing rings - GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(NPC.Center, -NPC.velocity * 0.33f, Color.DeepSkyBlue * 0.65f, new Vector2(0.5f, 1f), NPC.rotation, 0.12f, 0.24f, 18)); - - - switch (CurrentPhase) - { - case (int)PhaseType.Idle: - { - int frameDuration = 10; - int currentFrameIndex = (int)(NPC.frameCounter / frameDuration) % Main.npcFrameCount[Type]; - // If it's the third frame - bool isAllowedToMove = NPC.frame.Y / frameHeight == 2; - -                        // Move horizontally in short bursts -                        if (Timer >= 10 && NPC.velocity.Y == 0 && Math.Abs(NPC.velocity.X) < 1 && NPC.ai[2] == 0 && isAllowedToMove) - { - NPC.ai[2] = 1; - NPC.velocity.X = Main.rand.NextFloat(1.75f, 2.5f) * Main.rand.NextBool().ToDirectionInt(); - if (Main.rand.NextBool(4)) - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ShoreskipperGrunt", 2) { Volume = 0.9f, PitchVariance = 0.15f }, NPC.Center); - } - - // Increment the timer before the slide ends - if (NPC.ai[2] == 1) - { - NPC.ai[3]++; - } - - // Slow down quickly after sliding - else if (NPC.ai[2] == 2 && NPC.velocity.Y == 0) - { - NPC.velocity.X *= 0.835f; - NPC.ai[3]++; - } - - // Handle movement states - if (NPC.ai[3] > Main.rand.Next(20, 40)) - { - // If moving, enter slowdown - if (NPC.ai[2] == 1) - NPC.ai[2] = 2; - // If in slowdown, reset - else if (NPC.ai[2] == 2) - ChangePhase((int)PhaseType.Idle); - NPC.ai[3] = 0; - } - - NPC.direction = NPC.velocity.X.DirectionalSign(); - } - break; - - // Based off of Leerslug's initial detection phase. - case (int)PhaseType.Roar: - { - int roar = 20; - int startAI = 35; - NPC.velocity.X *= 0.9f; - - // Roar in place with a lil jump - if (Timer == roar) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ShoreskipperSighting") { Volume = 0.85f, Pitch = -0.1f, PitchVariance = 0.1f }, NPC.Center); - if (NPC.velocity.Y == 0) - { - NPC.velocity.Y = -2.5f; - } - } - - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - - if (Timer <= startAI && Timer >= roar && Timer % 5 == 0) - GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(NPC.Center + new Vector2((NPC.direction == 1 ? 28f : -28f), 0), Vector2.Zero, Color.Gray * 0.55f, new Vector2(1f, 1f), NPC.rotation, 0.05f, 0.6f, 16)); - - if (Timer > startAI) - ChangePhase((int)PhaseType.Jumps); - - if ((!Target.active || Target == null || (Target.Distance(NPC.Center) > 580 && !NPC.HasSight(Target.Center)) || Target.Distance(NPC.Center) > 700) && (NPC.velocity.Y == 0 || NPC.wet)) // If target it dead/out of range and if this shoreskipper isnt midair - { - NPC.velocity.X *= 0.33f; - Target = null; - ChangePhase((int)PhaseType.Idle); - } - } - break; - - case (int)PhaseType.Jumps: - { - // Hops toward the target - int jumpHeight = Target.Bottom.Y < NPC.Top.Y ? 6 : 4; - - // Reset hitbox status when grounded or right after exiting water - if (NPC.oldVelocity.Y != 0 && NPC.velocity.Y == 0 || (NPC.Calamity().newAI[1] == 1f)) - { - spawnedTackleHitbox = false; - NPC.velocity.X = 0; - } - - // Keep facing target while on the ground/water - if (NPC.velocity.Y == 0 || NPC.wet) - NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - - // Check if the shoreskipper landed - bool isGrounded = NPC.velocity.Y == 0; - - // Jump at the target on the 4th frame - bool isAtJumpFrame = NPC.frame.Y / frameHeight == 3; - - if ((!spawnedTackleHitbox && (isGrounded && isAtJumpFrame)) || (NPC.Calamity().newAI[1] == 1f && HasActiveTackle() == false)) // Latter set of conditions allows spawning a hitbox while skipping on water - { - if (isGrounded) - NPC.velocity.Y = -jumpHeight; - - // Face and chase after target - NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 4; - - // Spawn hitbox while jumping - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ProjectileType(), (int)(NPC.damage * Main.rand.NextFloat(0.7f, 1.4f)), Main.rand.Next(3, 7), Main.myPlayer, NPC.whoAmI); - if (Main.rand.NextBool()) - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ShoreskipperGrunt", 2) { Volume = 1f, PitchVariance = 0.15f }, NPC.Center); - - spawnedTackleHitbox = true; - } - } - - if ((!Target.active || Target == null || (Target.Distance(NPC.Center) > 580 && !NPC.HasSight(Target.Center)) || Target.Distance(NPC.Center) > 700) && (NPC.velocity.Y == 0 || NPC.wet)) // If target it dead/out of range and if this shoreskipper isnt midair - { - NPC.velocity.X = 0f; - Target = null; - ChangePhase((int)PhaseType.Idle); - } - } - break; - } - - NPC.StepUpBlocks(); - NPC.spriteDirection = NPC.direction; - - // In / on top of water - if (NPC.wet) - { - if (NPC.Calamity().newAI[0] == 0f || Timer % 120 == 0) - { - int newWaterDirection = NPC.direction; - if (Target != null && Target.active) - newWaterDirection = NPC.DirectionTo(Target.Center).X.DirectionalSign(); - else if (Main.rand.NextBool(3)) - newWaterDirection *= -1; - - NPC.Calamity().newAI[0] = newWaterDirection; - NPC.Calamity().newAI[1] = 0f; - } - - NPC.direction = (int)NPC.Calamity().newAI[0]; - NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); - notLandedFromWater = true; - - float waterAcceleration = 2.75f; - // Accelerate up to the cap of 12 - if (Math.Abs(NPC.velocity.X) < 12f) - NPC.velocity.X += NPC.direction * waterAcceleration; - NPC.velocity.X = MathHelper.Clamp(NPC.velocity.X, -12f, 12f); - } - - else - { - // Reset the water direction AI slot when the NPC leaves the water - NPC.Calamity().newAI[0] = 0f; - - if (NPC.Calamity().newAI[1] == 0f) // Just got out of water - { - NPC.Calamity().newAI[1] = 1f; // Will spawn a hitbox if aggroed - } - } - - Timer++; - } - - public void ChangePhase(int phaseNum, bool resetai2 = true, bool resetai3 = true) - { - CurrentPhase = phaseNum; - Timer = 0; - if (resetai2) - NPC.ai[2] = 0; - if (resetai3) - NPC.ai[3] = 0; - NPC.netUpdate = true; - - // Reset anim progress - NPC.frame.Y = 0; - NPC.frameCounter = 0; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (!spawnInfo.Player.Calamity().clamity) - { - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water) - return SpawnCondition.Cavern.Chance * 0.6f; - else if (spawnInfo.Player.Calamity().ZoneTimelessShores && spawnInfo.Water) - return SpawnCondition.Cavern.Chance * 0.25f; - } - return 0f; - } - - #region FX + Drawing - public override void FindFrame(int frameHeight) - { - bool isMidAir = NPC.velocity.Y != 0 && !NPC.wet; - int currentFrameIndex = NPC.frame.Y / frameHeight; - - if (CurrentPhase == (int)PhaseType.Roar) - { - NPC.frame.Y = 0; - return; - } - - if (isMidAir && NPC.frame.Y >= frameHeight * 4) - { - NPC.frame.Y = frameHeight * 4; // Cannot progress from last airborne frame until grounded again - return; - } - - NPC.frameCounter++; - if (NPC.frameCounter > (CurrentPhase == (int)PhaseType.Jumps ? 5 : 8)) // Progress faster when in jump phase - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * (Main.npcFrameCount[Type] - 1)) - { - NPC.frame.Y = 0; - } - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 6; k++) - { - GeneralParticleHandler.SpawnParticle(new GenericBubbleParticle(NPC.Center, new Vector2(Main.rand.NextFloat(3f, 7f) * hit.HitDirection, Main.rand.NextFloat(-5f, 5f)).RotatedByRandom(1), Main.rand.NextFloat(0.22f, 0.52f), NPC.rotation, Main.rand.Next(7, 11))); - } - - for (int k = 0; k < 6; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BloodWater, hit.HitDirection, -3f, 0, default, 0.8f); - } - SpawnGores(NPC, "Shoreskipper", 2); - } - - public override void OnKill() - { - for (int k = 0; k < 10; k++) - { - GeneralParticleHandler.SpawnParticle(new GenericBubbleParticle(NPC.Center, new Vector2(Main.rand.NextFloat(3.25f, 8.5f), Main.rand.NextFloat(-5f, 5f)).RotatedByRandom(MathHelper.TwoPi), Main.rand.NextFloat(0.26f, 0.62f), NPC.rotation, Main.rand.Next(8, 13))); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - return true; - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY; - - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - #endregion - } -} diff --git a/NPCs/SunkenSea/Shoreskipper.png b/NPCs/SunkenSea/Shoreskipper.png deleted file mode 100644 index 2c0a735cd7..0000000000 Binary files a/NPCs/SunkenSea/Shoreskipper.png and /dev/null differ diff --git a/NPCs/SunkenSea/Slugbun.cs b/NPCs/SunkenSea/Slugbun.cs deleted file mode 100644 index 66c5f257ea..0000000000 --- a/NPCs/SunkenSea/Slugbun.cs +++ /dev/null @@ -1,256 +0,0 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Terraria.DataStructures; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using ReLogic.Content; -using CalamityMod.Enums; -using System.Collections.Generic; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Slugbun : SunkenSeaNPC - { - public enum SlugSkin - { - Reef = 0, - Burrows = 1, - Polyp = 2, - Radiant = 3 - } - public ref float CurrentSkin => ref NPC.Calamity().newAI[2]; - - public static Asset burrowsTex; - public static Asset polypTex; - public static Asset radiantTex; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.PolypForest | SunkenSeaBiomeFlags.GleamingBurrows; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override List PreyIDs => new List(); - - public override void Load() - { - burrowsTex = ModContent.Request(Texture + "Gleaming"); - polypTex = ModContent.Request(Texture + "Polyp"); - radiantTex = ModContent.Request(Texture + "Radiant"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 4; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = NPCAIStyleID.Snail; - NPC.damage = 0; - NPC.width = 38; - NPC.height = 28; - NPC.defense = 0; - NPC.lifeMax = 20; - NPC.knockBackResist = 0f; - NPC.lavaImmune = false; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.GravityIgnoresLiquid = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.catchItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 3; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 3; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Slugbun") - }); - } - - public override void OnSpawn(IEntitySource source) - { - // Guppies released by the player do not randomize when spawned - if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) - { - CurrentSkin = NPC.ai[1]; - return; - } - // Red/Green in reefs, Green/Blue elsewhere - if (Main.player[NPC.target].Calamity().ZoneGleamingBurrows) - { - CurrentSkin = (int)SlugSkin.Burrows; - } - else if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - { - CurrentSkin = (int)SlugSkin.Reef; - } - else - { - CurrentSkin = (int)SlugSkin.Polyp; - } - NPC.TargetClosest(); - // 1 in 30 chance for a rare fish variant (rfv) - if (Main.rand.NextBool(30)) - { - CurrentSkin = (int)SlugSkin.Radiant; - NPC.rarity = 3; - } - // Decide item.......................... - switch (CurrentSkin) - { - case (int)SlugSkin.Polyp: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)SlugSkin.Burrows: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)SlugSkin.Reef: - NPC.catchItem = ModContent.ItemType(); - break; - case (int)SlugSkin.Radiant: - NPC.catchItem = ModContent.ItemType(); - break; - } - } - - public override void AI() - { - Tile vine = CalamityUtils.ParanoidTileRetrieval((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - // Set newAI[0] to 1 if the Slug is inside of a vine - if (vine.TileType == ModContent.TileType() && !NPC.justHit) - { - NPC.Calamity().newAI[0] = 1; - } - // Otherwise reset eating-related variables - else - { - NPC.Calamity().newAI[1] = 0; - NPC.Calamity().newAI[0] = 0; - } - // Eating behavior - if (NPC.Calamity().newAI[0] == 1) - { - NPC.velocity.X *= 0.1f; - // Play a crunch sound and spawn some grass dust randomly - if (Main.rand.NextBool(20)) - { - SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = 1.2f }, NPC.Center); - for (int i = 0; i < 4; i++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); - } - NPC.Calamity().newAI[1]++; - } - // After munching 10 times, the vine is broken and the Slugbun continues about its day - if (NPC.Calamity().newAI[1] == 10) - { - if (vine.TileType == ModContent.TileType()) - { - WorldGen.KillTile((int)NPC.position.X / 16, (int)NPC.position.Y / 16); - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter++; - if (NPC.frameCounter > 8) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 3) - { - NPC.frame.Y = 0; - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (CurrentSkin == (int)SlugSkin.Radiant) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantSlugbun"); - } - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneGleamingBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 1f; - } - return 0f; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GreenBlood, hit.HitDirection, -1f, 0, default, 1f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - switch (CurrentSkin) - { - case (int)SlugSkin.Burrows: - tex = burrowsTex.Value; - break; - case (int)SlugSkin.Polyp: - tex = polypTex.Value; - break; - case (int)SlugSkin.Radiant: - tex = radiantTex.Value; - break; - } - Vector2 pos = NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY - (Vector2.UnitY * 6).RotatedBy(NPC.rotation); - spriteBatch.Draw(tex, pos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Slugbun.png b/NPCs/SunkenSea/Slugbun.png deleted file mode 100644 index c0cedac24e..0000000000 Binary files a/NPCs/SunkenSea/Slugbun.png and /dev/null differ diff --git a/NPCs/SunkenSea/SlugbunGleaming.png b/NPCs/SunkenSea/SlugbunGleaming.png deleted file mode 100644 index 30eabd798a..0000000000 Binary files a/NPCs/SunkenSea/SlugbunGleaming.png and /dev/null differ diff --git a/NPCs/SunkenSea/SlugbunPolyp.png b/NPCs/SunkenSea/SlugbunPolyp.png deleted file mode 100644 index f66d3f3e55..0000000000 Binary files a/NPCs/SunkenSea/SlugbunPolyp.png and /dev/null differ diff --git a/NPCs/SunkenSea/SlugbunRadiant.png b/NPCs/SunkenSea/SlugbunRadiant.png deleted file mode 100644 index 3959bf1228..0000000000 Binary files a/NPCs/SunkenSea/SlugbunRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/Steampod.cs b/NPCs/SunkenSea/Steampod.cs deleted file mode 100644 index c5630ab79a..0000000000 --- a/NPCs/SunkenSea/Steampod.cs +++ /dev/null @@ -1,498 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using ReLogic.Content; -using CalamityMod.Enums; -using System.Collections.Generic; -using System; -using CalamityMod.Particles; -using CalamityMod.Items.Weapons.Ranged; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class Steampod : SunkenSeaNPC - { - public enum PhaseType - { - Idle = 0, - Hunting = 1, - LaunchUpSide = 2 - } - - public static Asset glowTex; - - public ref float CurrentPhase => ref NPC.ai[0]; - - public ref float Timer => ref NPC.ai[1]; - - public ref float Jetting => ref NPC.ai[2]; - - public ref float WalkTimer => ref NPC.Calamity().newAI[0]; - - public ref float TurnTimer => ref NPC.Calamity().newAI[1]; - - public ref float WalkOrStand => ref NPC.Calamity().newAI[2]; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override List PreyIDs => new List() - { - ModContent.NPCType() - }; - - public override void Load() - { - glowTex = ModContent.Request(Texture + "Glow"); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 17; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.aiStyle = -1; - NPC.damage = 40; - NPC.width = 44; - NPC.height = 44; - NPC.defense = 10; - NPC.lifeMax = 200; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.lavaImmune = true; - NPC.noGravity = false; - NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit38; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToWater = true; - NPC.Calamity().VulnerableToCold = true; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - for (int i = 0; i < 3; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - for (int i = 0; i < 3; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Steampod") - }); - } - - public override void AI() - { - switch (CurrentPhase) - { - case (int)PhaseType.Idle: - { - // Initialize its direction - if (NPC.direction == 0) - NPC.direction = Main.rand.NextBool() ? -1 : 1; - // Decide if it should walk or sit - float movementSpeed = CurrentPredator != null ? 2 : 1; - bool startMovement = false; - if (WalkTimer <= 0) - { - WalkTimer = Main.rand.Next(120, 270); - WalkOrStand = WalkOrStand <= 0 ? 1 : -1; - if (WalkOrStand == 1 && Main.rand.NextBool() && CurrentPrey == null) - { - NPC.direction *= -1; - } - startMovement = true; - } - bool lookingAtPredator = CurrentPredator != null && NPC.direction == Math.Sign(CurrentPredator.Center.X - NPC.Center.X); - bool pitCheck = FallCheck(16); - // If it bumps into something, jump or turn around - if ((!startMovement && TurnTimer <= 0 && (NPC.velocity.X == 0 || pitCheck) && WalkOrStand == 1) || lookingAtPredator) - { - // Jump if there are a couple tiles and a space above - if (!pitCheck && NPC.velocity.Y == 0 && !lookingAtPredator) - { - // Chance to do a jet - bool jet = Main.rand.NextBool(4) && Jetting == 0 && !NPC.lavaWet; - if (jet) - { - if (JumpCheck(16)) - { - TurnTimer = 0; - WalkTimer = 0; - WalkOrStand = 0; - Timer = 0; - CurrentPhase = (int)PhaseType.LaunchUpSide; - } - } - else if (JumpCheck(6)) - { - NPC.velocity.Y -= 7; - NPC.velocity.X = movementSpeed * NPC.direction; - WalkOrStand = 1; - TurnTimer = 10; - } - } - // Jet upwards if a pit is in the way - else if (Jetting == 0 && !NPC.lavaWet) - { - TurnTimer = 0; - WalkTimer = 0; - WalkOrStand = 0; - Timer = 0; - CurrentPhase = (int)PhaseType.LaunchUpSide; - } - } - // Attack - Entity target = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - if (target != null) - { - if (NPC.HasSight(target.Center) && Jetting == 0) - { - TurnTimer = 0; - WalkTimer = 0; - WalkOrStand = 0; - Timer = 0; - CurrentPhase = (int)PhaseType.Hunting; - } - } - - // Move - if (!NPC.justHit) - { - if (WalkOrStand == 1) - NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); - else if (NPC.velocity.Y == 0) - NPC.velocity.X *= 0.95f; - } - else if (WalkOrStand == -1) - { - WalkTimer = 0; - if (CurrentPredator != null) - { - WalkOrStand = 1; - WalkTimer = Main.rand.Next(180, 340); - } - } - // Bounce on lava - if (NPC.lavaWet) - { - NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); - } - CalamityUtils.StepUpBlocks(NPC); - } - break; - case (int)PhaseType.LaunchUpSide: - { - int jumpUp = 60; // When to jet up - int jetSide = jumpUp + 40; // When to jet sideways - int jetRate = NPC.lavaWet ? 1 : 2; // How often particles spawn - - // Reset if on ground or hit ceiling - if (NPC.velocity.Y == 0 && Jetting > 0 && Timer > 5) - { - NPC.velocity.Y = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - - // Increment timer while on the ground - if (NPC.velocity.Y == 0 && Jetting == 0) - { - NPC.velocity.X *= 0.95f; - Timer++; - } - - // Jump - if (Timer == jumpUp && Jetting == 0) - { - Jetting = 1; - NPC.velocity.Y = -12 * (NPC.lavaWet ? 1.5f : 1); - SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); - } - // Release particles - else if (Jetting == 1) - { - Timer++; - if (Timer > jumpUp) - { - NPC.velocity.Y += 0.01f; - if (Timer % jetRate == 0) - { - SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); - GeneralParticleHandler.SpawnParticle(p); - } - } - if (Timer == jetSide) - { - Timer = 0; - Jetting = 2; - } - } - // Jet sideways - else if (Jetting == 2) - { - NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - Timer++; - if (Timer == 1) - { - SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); - NPC.velocity.X = NPC.direction * 16; - NPC.velocity.Y = -2; - } - else if (Timer % jetRate == 0) - { - SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); - GeneralParticleHandler.SpawnParticle(p); - } - if (Timer > 1) - { - NPC.velocity.X += -NPC.direction * 0.01f; - } - // Failsafe if it gets trapped in jet mode - if (Timer > 300) - { - NPC.velocity.Y = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - } - } - break; - case (int)PhaseType.Hunting: - { - int jumpUp = 60; - int jetSide = jumpUp + 20; - int jetRate = 1; - - Entity target = CurrentPrey != null ? CurrentPrey : CurrentPlayer; - - // If the target is gone, reset - if ((NPC.velocity.Y == 0 && Jetting > 0 && Timer > jetSide) || target == null) - { - NPC.velocity.Y = 0; - NPC.velocity.X = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - - // Jet towards the target - if (NPC.velocity.Y == 0 && Jetting == 0) - { - NPC.velocity.X *= 0.95f; - Timer++; - if (Timer == jumpUp && Jetting == 0) - { - Jetting = 1; - NPC.velocity = NPC.SafeDirectionTo(target.Center) * 20; - SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); - } - } - // Release particles - if (Jetting == 1) - { - Timer++; - if (Timer % jetRate == 0) - { - SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); - GeneralParticleHandler.SpawnParticle(p); - } - NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - } - // Failsafe reset - if (Timer > 300) - { - NPC.velocity.Y = 0; - Timer = 0; - Jetting = -120; - CurrentPhase = (int)PhaseType.Idle; - NPC.rotation = 0; - break; - } - } - break; - } - - if (Jetting < 0) - Jetting++; - - if (WalkTimer > 0) - WalkTimer--; - - if (TurnTimer > 0) - TurnTimer--; - - NPC.spriteDirection = NPC.direction; - } - - // Checks if the horizontal position in front of it has lava or is a pit so that the pod can avoid it - public bool FallCheck(int height) - { - Point startPos = NPC.direction == 1 ? NPC.Right.ToTileCoordinates() : NPC.Left.ToTileCoordinates(); - for (int i = 1; i < height; i++) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i); - Tile above = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i - 2); - // If there's a tile, wegud - if (t.HasTile) - return false; - // If there's liquid or a pit, we not gud - if (t.LiquidAmount > 0 && above.LiquidAmount > 0) - return true; - - } - return true; - } - - // Checks if the horizontal position in front of the pod can be jumped up - public bool JumpCheck(int height) - { - Point startPos = NPC.direction == 1 ? NPC.BottomRight.ToTileCoordinates() : NPC.BottomLeft.ToTileCoordinates(); - bool canJump = false; - int add = NPC.direction == 1 ? 0 : -1; - int jumpHeight = height; - for (int i = jumpHeight; i > 0; i--) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + add, startPos.Y - i); - // If there are tiles obfuscating the jump position, return false - if (i > (jumpHeight - 2) && t.HasTile) - return false; - // If there is a tile to jump on, return true - if (t.HasTile) - { - canJump = true; - break; - } - } - return canJump; - } - - public override void FindFrame(int frameHeight) - { - bool still = (CurrentPhase == (int)PhaseType.Idle && NPC.velocity.X == 0); - if (!still) - { - NPC.frameCounter++; - } - if (NPC.frameCounter > 6) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - } - // Jet - if (Jetting > 0) - { - if (NPC.frame.Y >= 17 * frameHeight || NPC.frame.Y < 12 * frameHeight) - { - NPC.frame.Y = 12 * frameHeight; - } - } - // Curl up - else if (CurrentPhase != (int)PhaseType.Idle) - { - if (NPC.frame.Y > 11 * frameHeight) - { - NPC.frame.Y = 11 * frameHeight; - } - if (NPC.frame.Y < 7 * frameHeight) - { - NPC.frame.Y = 7 * frameHeight; - } - } - // Nothing - else if (still) - { - NPC.frame.Y = 7 * frameHeight; - } - // Walk - else - { - if (NPC.frame.Y >= 7 * frameHeight) - { - NPC.frame.Y = 0; - } - } - } - - protected override bool NPCSearchFilter(NPC n) - { - return base.NPCSearchFilter(n) || n == CurrentPrey && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - protected override bool PlayerSearchFilter(Player n) - { - return base.PlayerSearchFilter(n) || n == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneBasaltGully && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.Cavern.Chance * 0.5f; - } - return 0f; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage <= 0) - return; - target.AddBuff(BuffID.OnFire, 120); - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Lava, hit.HitDirection, -1f, 0, default, 1f); - } - CalamityUtils.SpawnGores(NPC, "Steampod", 3); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[NPC.type].Value; - spriteBatch.Draw(tex, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - spriteBatch.Draw(glowTex.Value, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, Color.White, NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); - - return false; - } - } -} diff --git a/NPCs/SunkenSea/Steampod.png b/NPCs/SunkenSea/Steampod.png deleted file mode 100644 index dffa275d82..0000000000 Binary files a/NPCs/SunkenSea/Steampod.png and /dev/null differ diff --git a/NPCs/SunkenSea/SteampodGlow.png b/NPCs/SunkenSea/SteampodGlow.png deleted file mode 100644 index 58d243d0ea..0000000000 Binary files a/NPCs/SunkenSea/SteampodGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentry.cs b/NPCs/SunkenSea/StormlionSentry.cs deleted file mode 100644 index 8f26a13bc2..0000000000 --- a/NPCs/SunkenSea/StormlionSentry.cs +++ /dev/null @@ -1,335 +0,0 @@ -using System; -using System.IO; -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class StormlionSentry : ModNPC - { - public ref float time => ref NPC.ai[0]; - public ref float attackTimer => ref NPC.ai[1]; - public ref float jitter => ref NPC.ai[2]; - public ref float jitterRate => ref NPC.localAI[0]; - public ref float headRot => ref NPC.localAI[1]; - public ref float attackFeedback => ref NPC.localAI[2]; - public bool canBeMoved => NPC.localAI[3] == 0; - public enum Mode - { - Idle, - Agressive, - Leaping, - Digging - } - public Mode AIState - { - get => (Mode)(int)NPC.ai[3]; - set => NPC.ai[3] = (int)value; - } - - public float fxFade = 1; - public float fxFadeInv => attackFeedback - 1; - public float targetRange = 830; - public int attackRate = 180; - public int digDir = 1; - public Vector2 headPosition; - public Vector2 attackPosition; - - public static Asset headTexture; - public static Asset mandibleTexture; - public static Asset bodyTexture; - - public override void Load() - { - headTexture = ModContent.Request(Texture + "Head"); - mandibleTexture = ModContent.Request(Texture + "Mandible"); - bodyTexture = ModContent.Request(Texture + "Body"); - } - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 20f }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.width = 50; - NPC.height = 108; - NPC.lifeMax = 60; - NPC.damage = 15; - NPC.defense = 3; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 1); - NPC.HitSound = Effects.StormlionEffects.Hit; - NPC.DeathSound = Effects.StormlionEffects.Killed; - NPC.noGravity = true; - NPC.noTileCollide = true; // Custom tile collision - - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - AIState = Mode.Idle; - attackFeedback = 1; - headRot = -MathHelper.PiOver2; - - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange( - [ - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.StormlionSentry") - ]); - } - - public override void AI() - { - NPC.TargetClosest(false); - Player target = Main.player[NPC.target]; - NPC.spriteDirection = NPC.direction; - - bool npcFullyInTiles = Collision.SolidCollision(NPC.Center - Vector2.UnitY * 13, 15, 15); - bool npcOnTiles = Collision.SolidCollision(NPC.Center + Vector2.UnitY * 10, 15, 15); - bool targetInRange = Utils.Distance(target.Center, NPC.Center) <= targetRange && Collision.CanHit(headPosition, 1, 1, target.Center, 1, 1); - - attackFeedback = MathHelper.Lerp(attackFeedback, 1, 0.025f); - fxFade = Utils.GetLerpValue(0, attackRate, attackTimer, true); - - if (!npcOnTiles) - { - if (NPC.velocity.Y < 0) - NPC.velocity.Y *= 0.97f; - if (NPC.velocity.Y < 20) - NPC.velocity.Y += 0.5f; - NPC.velocity.X *= 0.97f; - } - - if (!npcFullyInTiles && npcOnTiles && AIState != Mode.Digging) - { - NPC.localAI[3] = 5; - AIState = Mode.Digging; - } - if (AIState == Mode.Idle) - { - attackTimer = (int)MathHelper.Lerp(attackTimer, 0, 0.01f); - jitterRate = MathHelper.Lerp(jitterRate, 0.1f, 0.05f); - headRot = headRot.AngleLerp(-Vector2.UnitY.ToRotation(), 0.02f); - if (targetInRange && !canBeMoved) - AIState = Mode.Agressive; - - if (Main.rand.NextBool(15) && time % 60 == 0) - { - jitterRate = 4.7f; - SoundEngine.PlaySound((Main.rand.NextBool() ? Effects.StormlionEffects.Idle1 : Effects.StormlionEffects.Idle2) with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.2f, 0.1f) }, NPC.Center); - } - } - if (AIState == Mode.Agressive) - { - if (!targetInRange && attackTimer >= 0) - AIState = Mode.Idle; - - if (attackTimer >= 0) - { - jitterRate = MathHelper.Lerp(jitterRate, 1f + 3f * Utils.GetLerpValue(0, attackRate, attackTimer), 0.035f); - headRot = headRot.AngleLerp(NPC.Center.DirectionTo(target.Center).ToRotation(), 0.035f); - } - else - headRot = headRot.AngleLerp(NPC.Center.DirectionTo(target.Center).ToRotation(), 0.01f); - - if (attackTimer == attackRate) - { - SoundEngine.PlaySound(Effects.StormlionEffects.Attack with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, NPC.Center); - - Projectile.NewProjectile(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 12), ModContent.ProjectileType(), 15, 0f, Main.myPlayer); - for (int i = 0; i <= 12; i++) - { - float variance = Main.rand.NextFloat(-0.6f, 0.6f); - int dustStyle = Effects.StormlionEffects.EnergyDust; - Dust dust2 = Dust.NewDustPerfect(attackPosition, dustStyle); - dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); - dust2.velocity = (headRot.ToRotationVector2() * 15).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)); - dust2.noGravity = true; - dust2.color = Effects.StormlionEffects.EnergyColor; - } - - attackFeedback = 2; - attackTimer = -60; - jitterRate = 0; - NPC.ForceNetUpdate(); - } - attackTimer++; - } - if (AIState == Mode.Digging) - { - if (time % 10 == 0) - { - NPC.velocity = Vector2.Zero; - headRot = MathHelper.ToRadians(4 * digDir) - MathHelper.PiOver2; - SoundEngine.PlaySound(SoundID.WormDig with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, NPC.Center); - NPC.Center += Vector2.UnitY * 2; - digDir *= -1; - } - if (npcFullyInTiles) - AIState = Mode.Idle; - } - - if (!canBeMoved) - NPC.velocity = Vector2.Zero; - - - bool dancing = false; // They will dance if a "music projectile" is on screen of if the player is using an instrument (except drums because that would be annoying to make work) - for (int x = 0; x < Main.maxProjectiles; x++) - { - if (Main.mouseLeft && (target.HeldItem.type == ItemID.Bell || target.HeldItem.type == ItemID.CarbonGuitar || target.HeldItem.type == ItemID.IvyGuitar || target.HeldItem.type == ItemID.Harp || target.HeldItem.type == ItemID.TheAxe)) - { - dancing = true; - } - Projectile projectile = Main.projectile[x]; - if (!dancing && projectile.active && (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ProjectileID.SparkleGuitar || projectile.type == ProjectileID.EighthNote || projectile.type == ProjectileID.QuarterNote || projectile.type == ProjectileID.TiedEighthNote)) - { - dancing = true; - } - } - - if (dancing) - { - float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 14.37f / MathHelper.Pi); - if (Main.zenithWorld) - { - if (time % 2 == 0) - { - SoundEngine.PlaySound(Effects.StormlionEffects.Attack with { Volume = 0.2f, Pitch = 0.4f * sine, MaxInstances = 30 }, NPC.Center); - Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 6), ModContent.ProjectileType(), 15 * target.statLifeMax2, 0f, Main.myPlayer); - proj.friendly = true; - proj.hostile = false; - } - fxFade = 1; - attackTimer = attackRate * 0.9f; - } - else - attackTimer = 0; - jitterRate = 1; - NPC.dontTakeDamage = true; - headRot = MathHelper.ToRadians(100 * sine) - MathHelper.PiOver2; - AIState = Mode.Idle; - } - else - NPC.dontTakeDamage = false; - - float orbSine = (float)Math.Sin(time * 0.575f / MathHelper.Pi) * Utils.GetLerpValue(attackRate * 1.1f, 0, attackTimer); - headPosition = NPC.Center - (Vector2.UnitY * 27).RotatedBy(NPC.rotation) + headRot.ToRotationVector2() * 12 + NPC.velocity; - attackPosition = headPosition + headRot.ToRotationVector2() * (25 + 8 * orbSine); - NPC.rotation = Utils.AngleLerp(0, headRot + MathHelper.PiOver2, 0.35f); - - - if (fxFade > 0) - { - Lighting.AddLight(attackPosition, Effects.StormlionEffects.EnergyColor.ToVector3() * 0.7f * fxFade); - } - - time++; - jitter += jitterRate; - } - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, Effects.StormlionEffects.FleshDust, hit.HitDirection, -1f, 0, Effects.StormlionEffects.FleshColor, Main.rand.NextFloat(0.7f, 1.1f)); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 35; k++) - { - bool type = !Main.rand.NextBool(3); - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, type ? Effects.StormlionEffects.EnergyDust : Effects.StormlionEffects.FleshDust, hit.HitDirection, -1f, 0, type ? Effects.StormlionEffects.EnergyColor : Effects.StormlionEffects.FleshColor, Main.rand.NextFloat(0.7f, 1.1f)); - } - CalamityUtils.SpawnGores(NPC, "StormlionSentry", 3); - } - } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return false; - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - Vector2 spawnPosition = new Vector2(spawnInfo.SpawnTileX * 16 + 8, spawnInfo.SpawnTileY * 16); - bool npcOnTiles = Collision.SolidCollision(spawnPosition + Vector2.UnitY * 50, 20, 20); - - if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && npcOnTiles) - { - return SpawnCondition.Cavern.Chance * 8f; - } - return 0f; - } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType()); - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Texture2D tex = TextureAssets.Npc[Type].Value; - if (NPC.IsABestiaryIconDummy) - { - spriteBatch.Draw(tex, NPC.Center - screenPos, null, drawColor, NPC.rotation, tex.Size() / 2f, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - return false; - } - if (time == 0) - return false; - - Texture2D body = bodyTexture.Value; - Texture2D head = headTexture.Value; - Texture2D mandible = mandibleTexture.Value; - Texture2D attack = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - - spriteBatch.Draw(body, NPC.Center - screenPos, null, drawColor, NPC.rotation, body.Size() / 2f, NPC.scale, SpriteEffects.None, 0f); - spriteBatch.Draw(head, headPosition - screenPos, null, drawColor, headRot + MathHelper.PiOver2, head.Size() / 2f, NPC.scale, SpriteEffects.None, 0f); - for (int i = -1; i <= 1; i += 2) - { - float sine = (float)Math.Sin(jitter * 0.575f / MathHelper.Pi) * Utils.GetLerpValue(4.8f, 0, jitterRate); - Vector2 madiblePos = headPosition + (Vector2.UnitX * 10 * i).RotatedBy(headRot + MathHelper.PiOver2); - Vector2 madibleOrigin = (new Vector2(i == 1 ? 0 : mandible.Width, mandible.Height)); - float mandibleRot = MathHelper.ToRadians(5 * i) + MathHelper.Lerp(MathHelper.ToRadians(20) * sine * i, MathHelper.ToRadians(50) * i * fxFadeInv, fxFadeInv); - spriteBatch.Draw(mandible, madiblePos - screenPos, null, drawColor, headRot + mandibleRot + MathHelper.PiOver2, madibleOrigin, NPC.scale, i == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); - } - - if (attackTimer > 0) - { - float fade = (float)Math.Pow(fxFade, 2); - for (int i = 0; i < 3; i++) - spriteBatch.Draw(attack, attackPosition - screenPos, null, Color.Lerp(Effects.StormlionEffects.EnergyColor, Color.White, i * 0.3f) with { A = 0 } * fade, headRot, attack.Size() / 2f, (NPC.scale * 0.3f - (i * 0.08f)) * fade * Main.rand.NextFloat(0.8f, 1.1f), SpriteEffects.None, 0f); - } - return false; - } - } -} diff --git a/NPCs/SunkenSea/StormlionSentry.png b/NPCs/SunkenSea/StormlionSentry.png deleted file mode 100644 index 8e5990842a..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentry.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentryBody.png b/NPCs/SunkenSea/StormlionSentryBody.png deleted file mode 100644 index 0e8b945f4d..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentryBody.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentryHead.png b/NPCs/SunkenSea/StormlionSentryHead.png deleted file mode 100644 index eefe88b4e4..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentryHead.png and /dev/null differ diff --git a/NPCs/SunkenSea/StormlionSentryMandible.png b/NPCs/SunkenSea/StormlionSentryMandible.png deleted file mode 100644 index 474cbbfaa0..0000000000 Binary files a/NPCs/SunkenSea/StormlionSentryMandible.png and /dev/null differ diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs index 79991669b4..60766f4dec 100644 --- a/NPCs/SunkenSea/SunkenSeaNPC.cs +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.SunkenSea ///
/// The NPC to evaluate. /// if the NPC is a valid target; otherwise, . - protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)) && !(n.type == ModContent.NPCType() && n.alpha > 0); + protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); /// /// Updates the current targets of this creature, including prey, predators, and players, based on detection logic. diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 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/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 6a9ade6571..8c0d370419 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"), diff --git a/NPCs/TownNPCs/ShadySalesman.cs b/NPCs/TownNPCs/ShadySalesman.cs new file mode 100644 index 0000000000..3168cdbd5b --- /dev/null +++ b/NPCs/TownNPCs/ShadySalesman.cs @@ -0,0 +1,736 @@ +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; + +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(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 index 3c15194e38..67d8ddb94f 100644 --- a/NPCs/TownNPCs/TownPiggy.cs +++ b/NPCs/TownNPCs/TownPiggy.cs @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.TownNPCs AIType = NPCID.TownBunny; NPC.damage = 0; NPC.defense = 0; - NPC.lifeMax = 50; + NPC.lifeMax = 250; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.5f; @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool CanTownNPCSpawn(int numTownNPCs) { - if (CalamityWorld.unlockedTownPig) + if (CalamityWorld.unlockedTownPig && !NPC.AnyNPCs(ModContent.NPCType())) { return true; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs index f011ff78bd..a41c9c6511 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhu/BrainOfCthulhuAI.cs @@ -352,8 +352,6 @@ public class BrainOfCthulhuAI : VanillaAIOverride NPC.defense = NPC.defDefense; NPC.chaseable = (AIState != BrainAIState.IllusionDash && AIState != BrainAIState.IllusionTrick); - if (Main.getGoodWorld && AIState >= BrainAIState.Phase2TransitionOpen) - NPC.brainOfGravity = NPC.whoAmI; } else NPC.defense = (int)(NPC.defDefense * Phase1DefenseMultiplier); 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/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/FeatherParticle.cs b/Particles/FeatherParticle.cs new file mode 100644 index 0000000000..54a6bd9ab9 --- /dev/null +++ b/Particles/FeatherParticle.cs @@ -0,0 +1,160 @@ +using System; +using System.Threading; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class FeatherParticle : Particle + { + public float RotationSpeed; + + public float Opacity; + + public float SwayAngleStrength; + + public bool AffectedByWind; + + public bool NoGravity; + + public bool ShouldCollideWithTiles; + + public bool DieWithTileCollision; + + private int DeathTimer; + + public static float WaveAngle => MathHelper.ToRadians(25f); + + public float WaveFrameState { get; private set; } + + public int SwayInterval { get; private set; } + + public bool CurrentlyCollidingWithTiles { get; private set; } + + public FeatherParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, float? rotationSpeed = null, float swayAngleStrength = 1f, bool affectedByWind = false, bool noGravity = false, bool shouldCollideWithTiles = false, bool dieWithTileCollision = false) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifetime; + RotationSpeed = rotationSpeed ?? Main.rand.NextFloat(120f, 150f) * Main.rand.NextBool().ToDirectionInt(); + SwayAngleStrength = swayAngleStrength; + AffectedByWind = affectedByWind; + NoGravity = noGravity; + ShouldCollideWithTiles = shouldCollideWithTiles; + DieWithTileCollision = dieWithTileCollision; + + Variant = Main.rand.Next(3); + Opacity = 0f; + SwayInterval = Main.rand.Next(75, 150); + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + } + + public override string Texture => "CalamityMod/Particles/FeatherParticle"; + + public override bool SetLifetime => false; + + public override bool UseCustomDraw => true; + + public override int FrameVariants => 3; + + public override void Update() + { + if (!CurrentlyCollidingWithTiles) + Rotation += (MathHelper.Pi / RotationSpeed) + (Velocity.X * 0.01f); + + // Original math from AstralGodRay.cs. + int waveSign = (WaveFrameState > 0f).ToDirectionInt(); + if (Math.Abs(WaveFrameState) < 1f) + { + int dirToUse = WaveFrameState == 0 ? (Main.rand.NextBool() ? -1 : 1) : waveSign; + waveSign = -dirToUse; + WaveFrameState = dirToUse * SwayInterval * 0.5f; + } + + // Switch directions whenever necessary. + else if (Math.Abs(WaveFrameState) > SwayInterval) + WaveFrameState = -waveSign; + else + WaveFrameState += waveSign; + + // Rotate velocity towards the wave angle to appear as if its swaying side to side. + float swayAngle = WaveAngle / (SwayInterval * 0.5f); + Velocity = Velocity.RotatedBy(waveSign * swayAngle * SwayAngleStrength); + + Velocity.X *= 0.98f; + if (Velocity.Y < 0.6f && !NoGravity) + Velocity.Y += 0.005f; + else + Velocity.Y *= 0.98f; + + // Move with wind speed. + if (AffectedByWind) + Velocity.X += Main.windSpeedCurrent / 3f; + + // Tile collision. + if (ShouldCollideWithTiles) + { + CurrentlyCollidingWithTiles = false; + + Vector2 hitboxDimensions = new(12f, 12f); + if (Collision.SolidCollision(Position, (int)hitboxDimensions.X, (int)hitboxDimensions.Y)) + { + Velocity = Collision.TileCollision(Position, Velocity, (int)hitboxDimensions.X, (int)hitboxDimensions.Y); + CurrentlyCollidingWithTiles = true; + } + + if (Collision.WetCollision(Position, (int)hitboxDimensions.X, (int)hitboxDimensions.Y)) + { + Velocity.Y *= 0.8f; + CurrentlyCollidingWithTiles = true; + } + } + + if (DieWithTileCollision && ShouldCollideWithTiles) + { + if (CurrentlyCollidingWithTiles) + { + Opacity = MathHelper.Lerp(1f, 0f, (float)(DeathTimer / 45)); + if (DeathTimer >= 45) + { + Kill(); + return; + } + + DeathTimer++; + } + else + { + Opacity = MathHelper.Clamp(Opacity + 0.075f, 0f, 1f); + } + } + else + { + int fadeInTime = 45 - (int)(Lifetime * 0.2f); + if (fadeInTime < 20) + fadeInTime = 20; + int fadeOutTime = (int)(Lifetime * 0.8f); + Opacity = Utils.GetLerpValue(0, fadeInTime, Time, true) * Utils.GetLerpValue(Lifetime, fadeOutTime, Time); + + if (Time >= Lifetime) + { + Kill(); + return; + } + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + Color lightColor = Color.MultiplyRGB(Lighting.GetColor((Position / 16).ToPoint())); + Rectangle frame = texture.Frame(1, FrameVariants, 0, Variant); + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, lightColor * Opacity, Rotation, frame.Size() * 0.5f, Scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Particles/FeatherParticle.png b/Particles/FeatherParticle.png new file mode 100644 index 0000000000..874bccc051 Binary files /dev/null and b/Particles/FeatherParticle.png differ diff --git a/Particles/FlyParticle.cs b/Particles/FlyParticle.cs new file mode 100644 index 0000000000..973441726c --- /dev/null +++ b/Particles/FlyParticle.cs @@ -0,0 +1,94 @@ +using System; +using CalamityMod.Systems.Graphic.TempParticleSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.Particles +{ + public class FlyParticle : Particle + { + public float Opacity; + + private bool WasSpawnedWithAnchor; + + public Entity AnchorEntity { get; private set; } + + public Vector2 StoredPosition { get; private set; } + + public float HeightToNeverGoBelow { get; private set; } + + public FlyParticle(Vector2 position, float scale, int lifetime, Entity anchorEntity = null) + { + Position = position; + Scale = scale; + Lifetime = lifetime; + AnchorEntity = anchorEntity; + + if (anchorEntity == null) + { + StoredPosition = position; + HeightToNeverGoBelow = position.Y + 8f; + WasSpawnedWithAnchor = false; + } + else + { + WasSpawnedWithAnchor = true; + } + + Variant = Main.rand.Next(2); + Color = Color.White; + AffectedByLight = true; + } + + public override string Texture => "Terraria/Images/Extra_262"; + + public override bool SetLifetime => true; + + public override bool UseCustomDraw => true; + + public override int FrameVariants => 2; + + public override void Update() + { + if (WasSpawnedWithAnchor) + { + StoredPosition = AnchorEntity.Top; + HeightToNeverGoBelow = AnchorEntity.Top.Y + 8f; + if (!AnchorEntity.active || AnchorEntity == null) + { + Kill(); + return; + } + } + + Velocity += new Vector2(MathF.Sign(StoredPosition.X - Position.X) * 0.02f, MathF.Sign(StoredPosition.Y - Position.Y) * 0.02f); + if (Time % 30 == 0 && Main.rand.NextBool(2)) + { + Velocity = Main.rand.NextVector2Circular(1f, 1f); + if (Main.rand.NextBool(2)) + Velocity /= 2; + } + + if (Position.Y > HeightToNeverGoBelow) + { + Position.Y = HeightToNeverGoBelow; + if (Velocity.Y > 0f) + Velocity *= -1f; + } + + Variant = Time % 6 / 3; + int fadeInTime = (int)(Lifetime * 0.13f); + int fadeOutTime = (int)(Lifetime * 0.93f); + Opacity = Utils.GetLerpValue(0f, fadeInTime, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - fadeOutTime, Time, true); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Color lightColor = Color.MultiplyRGB(Lighting.GetColor((Position / 16).ToPoint())); + Rectangle frame = GeneralParticleHandler.GetTexture(Type).Frame(1, FrameVariants, 0, Variant); + SpriteEffects effects = (Velocity.X > 0f) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, frame, lightColor * Opacity, Rotation, frame.Size() * 0.5f, Scale, effects, 0f); + } + } +} diff --git a/Particles/GraveyardMistParticle.cs b/Particles/GraveyardMistParticle.cs new file mode 100644 index 0000000000..262597d307 --- /dev/null +++ b/Particles/GraveyardMistParticle.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.Particles +{ + public class GraveyardMistParticle : Particle + { + public float StretchFactor; + + public float BaseOpacity; + + public int Direction; + + public float Opacity { get; private set; } + + public int TextureIndex { get; private set; } + + public GraveyardMistParticle(Vector2 spawnPosition, Vector2 velocity, Color color, float scale, float baseOpacity, int lifetime, int textureIndex) + { + Position = spawnPosition; + Velocity = velocity; + Color = color; + Scale = scale; + BaseOpacity = baseOpacity; + Lifetime = lifetime; + TextureIndex = textureIndex; + StretchFactor = Main.rand.NextFloat(1f, 2f); + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool SetLifetime => true; + + public override bool UseCustomDraw => true; + + public override void Update() + { + float halfLifetime = Lifetime / 2; + Opacity = BaseOpacity * MathHelper.Lerp(0f, 1f, MathF.Sin(MathHelper.TwoPi * (Time / halfLifetime))); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D mistTexture = Main.Assets.Request("Images/Gore_" + TextureIndex).Value; + SpriteEffects spriteEffects = (Velocity.X > 0) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 scale = new Vector2(StretchFactor, 1f) * Scale; + spriteBatch.Draw(mistTexture, Position - Main.screenPosition, mistTexture.Frame(), Color * Opacity * 0.375f, Rotation, mistTexture.Frame().Size() * 0.5f, scale, spriteEffects, 0f); + } + } +} diff --git a/Particles/QuickSparkleParticle.cs b/Particles/QuickSparkleParticle.cs new file mode 100644 index 0000000000..ab4cad8d43 --- /dev/null +++ b/Particles/QuickSparkleParticle.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class QuickSparkleParticle : Particle + { + public float StoredScale; + + public float LightStrength; + + public bool EmitLight; + + public Vector2 StretchFactor; + + public QuickSparkleParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, Vector2? stretchFactor = null,bool emitLight = false, float lightStrength = 1.45f) + { + Position = position; + Velocity = velocity; + Color = color; + StoredScale = scale; + Lifetime = lifetime; + StretchFactor = stretchFactor ?? new(0.75f, 1.75f); + EmitLight = emitLight; + LightStrength = lightStrength; + } + + public override bool SetLifetime => true; + + public override bool UseAdditiveBlend => true; + + public override bool UseCustomDraw => true; + + public override string Texture => "CalamityMod/ExtraTextures/ShineFlare"; + + public override void Update() + { + Velocity *= 0.92f; + Scale = MathHelper.Lerp(0f, StoredScale, MathF.Sin(LifetimeCompletion * MathHelper.Pi)); + if (EmitLight) + Lighting.AddLight(Position, Color.ToVector3() * Scale * LightStrength); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, null, Color.White, Rotation, GeneralParticleHandler.GetTexture(Type).Size() * 0.5f, Scale * StretchFactor * 0.1f, 0, 0f); + spriteBatch.Draw(GeneralParticleHandler.GetTexture(Type), Position - Main.screenPosition, null, Color, Rotation, GeneralParticleHandler.GetTexture(Type).Size() * 0.5f, Scale * StretchFactor * 0.2f, 0, 0f); + } + } +} diff --git a/Particles/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/ReforgeChange.cs b/Prefixes/ReforgeChange.cs index 45b15fdb4b..4ac43c710e 100644 --- a/Prefixes/ReforgeChange.cs +++ b/Prefixes/ReforgeChange.cs @@ -203,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/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/Boss/CrimulanSpike.cs b/Projectiles/Boss/CrimulanSpike.cs deleted file mode 100644 index 4daf6e82f2..0000000000 --- a/Projectiles/Boss/CrimulanSpike.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class CrimulanSpike : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - private const int TimeLeft = 600; - private const int FadeOutTime = 30; - private float MaxVelocity => Projectile.ai[0]; - private float Acceleration => Projectile.ai[1]; - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.hostile = true; - Projectile.penetrate = -1; - Projectile.timeLeft = TimeLeft; - } - - public override void AI() - { - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= Acceleration; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= MaxVelocity; - } - } - - if (Projectile.timeLeft < FadeOutTime) - Projectile.Opacity -= 1f / FadeOutTime; - - if (Main.rand.NextBool()) - { - Color dustColor = Color.Crimson; - dustColor.A = 150; - int redSpiky = Dust.NewDust(Projectile.position - Projectile.velocity * 3f, Projectile.width, Projectile.height, DustID.TintableDust); - Main.dust[redSpiky].velocity *= 0.3f; - Main.dust[redSpiky].velocity += Projectile.velocity * 0.3f; - Main.dust[redSpiky].color = dustColor; - Main.dust[redSpiky].scale = 1.4f; - Main.dust[redSpiky].noGravity = true; - } - } - - public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = Projectile.ai[2] > 0f ? ModContent.Request("CalamityMod/Projectiles/Boss/CrimulanSpike" + ((int)Projectile.ai[2] + 1)).Value : TextureAssets.Projectile[Projectile.type].Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); - return false; - } - } -} diff --git a/Projectiles/Boss/CrimulanSpike.png b/Projectiles/Boss/CrimulanSpike.png deleted file mode 100644 index d6e65576a9..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike2.png b/Projectiles/Boss/CrimulanSpike2.png deleted file mode 100644 index 92b9a54542..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike2.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike3.png b/Projectiles/Boss/CrimulanSpike3.png deleted file mode 100644 index 01bcdccfa6..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike3.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike4.png b/Projectiles/Boss/CrimulanSpike4.png deleted file mode 100644 index ffa29a97aa..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike4.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike5.png b/Projectiles/Boss/CrimulanSpike5.png deleted file mode 100644 index 4b12092bf6..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike5.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike6.png b/Projectiles/Boss/CrimulanSpike6.png deleted file mode 100644 index 2804faaebc..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike6.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike7.png b/Projectiles/Boss/CrimulanSpike7.png deleted file mode 100644 index e5130f045c..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike7.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike8.png b/Projectiles/Boss/CrimulanSpike8.png deleted file mode 100644 index f39dc36563..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike8.png and /dev/null differ diff --git a/Projectiles/Boss/CrimulanSpike9.png b/Projectiles/Boss/CrimulanSpike9.png deleted file mode 100644 index 56f28636fc..0000000000 Binary files a/Projectiles/Boss/CrimulanSpike9.png and /dev/null differ diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 21e7016604..f4bf44ceb7 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -121,5 +122,11 @@ namespace CalamityMod.Projectiles.Boss } public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 120, true); + } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 1b5bd9cb67..36404593ba 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Dusts; using CalamityMod.Graphics.Primitives; @@ -8,6 +9,7 @@ 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; @@ -87,85 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.End(out var ss); - var device = Main.instance.GraphicsDevice; - - using (Main.spriteBatch.Scope()) - { - using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent)) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]); - var len = Math.Min(Projectile.oldPos.Length, 32); - for (var i = 0; i < len; i++) - { - Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size*0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color = FireColorFunction(i / (float)len, Projectile.oldPos[i]); - var color2 = ProvUtils.GetProjectileColor(255,true); - float width = FireWidthFunction(i / (float)len, Projectile.oldPos[i]); - Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0}) * (1- i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) /tex.Width * 0.25f, SpriteEffects.None, 0f); - } - Main.spriteBatch.End(); - } - } - - using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent)) - { - - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - - float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; - Color baseColor2 = ProvUtils.GetProjectileColor(255); - baseColor.A = 0; - baseColor *= lerpMult; - baseColor2 *= lerpMult; - Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f); - - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); - - float upRight = MathHelper.PiOver4; - float up = MathHelper.PiOver2; - float upLeft = 3f * MathHelper.PiOver4; - float left = MathHelper.Pi; - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); - - scale = new Vector2(1f, 1f); - texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; - using (Main.spriteBatch.Scope()) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, baseColor2, 0, texture.Size() * 0.5f, 1f, 0, 0f); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); - Main.spriteBatch.End(); - } - Main.spriteBatch.End(); - } - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Main.spriteBatch.End(); - Main.spriteBatch.Begin(ss); + //drawn by the HolyBurnOrbDrawer system return false; } public float FireWidthFunction(float completion, Vector2 pos) @@ -250,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/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 7981939956..71fcbfaa70 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -87,80 +87,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Main.spriteBatch.End(out var ss); - var device = Main.instance.GraphicsDevice; - - using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent)) - { - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]); - var len = Math.Min(Projectile.oldPos.Length, 32); - for (var i = 0; i < len; i++) - { - Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color = FireCoreColorFunction(i / (float)len, Projectile.oldPos[i]); - var color2 = new Color(0, 25, 0); - float width = FireWidthFunction(i / (float)len, Projectile.oldPos[i]); - Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width * 0.25f, SpriteEffects.None, 0f); - } - Main.spriteBatch.End(); - } - - using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent)) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - - - float vel = Projectile.velocity.Length() / 8; - Projectile.localAI[1] += vel; - - Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Color brightGreen = new Color(54, 209, 54, 0); - Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Vector2 halfTextureSize = drawTexture.Size() / 2f; - Color halfBrightGreen = brightGreen * 0.5f; - float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f))); - Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f); - Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; - Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; - brightGreen *= timeLeftColorScale; - halfBrightGreen *= timeLeftColorScale; - - Vector2 position3 = projDirection + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); - var scale = new Vector2(1f, 1f); - var texture = ModContent.Request("CalamityMod/Particles/GlowOrbParticle").Value; - using (Main.spriteBatch.Scope()) - { - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, new Color(54, 209, 54), 0, texture.Size() * 0.5f, 1f, 0, 0f); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f); - Main.spriteBatch.End(); - } - Main.spriteBatch.End(); - } - - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Main.spriteBatch.End(); - Main.spriteBatch.Begin(ss); + //drawn by the HolyBurnOrbDrawer system return false; } public float FireWidthFunction(float completion, Vector2 pos) diff --git a/Projectiles/Boss/PermafrostMeat.cs b/Projectiles/Boss/PermafrostMeat.cs index 69adc783c8..7bc79ca487 100644 --- a/Projectiles/Boss/PermafrostMeat.cs +++ b/Projectiles/Boss/PermafrostMeat.cs @@ -12,8 +12,6 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Food/DeliciousMeat"; - public override void SetDefaults() { Projectile.width = 30; diff --git a/Projectiles/Boss/PermafrostMeat.png b/Projectiles/Boss/PermafrostMeat.png new file mode 100644 index 0000000000..0fe6eb2cc4 Binary files /dev/null and b/Projectiles/Boss/PermafrostMeat.png differ diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index e40f6f9e35..1f605d1d5d 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Boss public class UnstableCrimulanGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override void SetDefaults() { Projectile.width = 30; @@ -28,9 +27,6 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Vector3 light = new Vector3(0.5f, 0.1f, 0.1f) * Projectile.Opacity; - Lighting.AddLight(Projectile.Center, light.X, light.Y, light.Z); - // Fly up and then fall down if (Projectile.ai[0] == 1f) { @@ -62,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Crimson; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, 0, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } @@ -75,7 +71,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 17ab17c58b..64838feff8 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Boss public class UnstableEbonianGlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override void SetDefaults() { Projectile.width = 30; @@ -28,16 +27,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Vector3 light = new Vector3(0.5f, 0.1f, 0.5f) * Projectile.Opacity; - Lighting.AddLight(Projectile.Center, light.X, light.Y, light.Z); - - if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive || Projectile.ai[0] == 1f)) + if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive)) { float velocityMult = CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; - - if (Projectile.ai[0] == 1f) - velocityMult += 0.02f; - Projectile.velocity *= velocityMult; } @@ -48,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss { Color dustColor = Color.Lavender; dustColor.A = 150; - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, 0, dustColor); + int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TintableDust, 0f, 0f, Projectile.alpha, dustColor); Main.dust[dust].noGravity = true; } @@ -61,7 +53,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + lightColor.R = (byte)(255 * Projectile.Opacity); + lightColor.G = (byte)(255 * Projectile.Opacity); + lightColor.B = (byte)(255 * Projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index fc0ef7d944..459a5c55cb 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -150,6 +150,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. ///
@@ -385,6 +390,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; @@ -424,8 +432,14 @@ namespace CalamityMod.Projectiles } } - 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(); + 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 @@ -462,8 +476,10 @@ namespace CalamityMod.Projectiles if (ProjectileID.Sets.LightPet[projectile.type] && Main.LocalPlayer.Calamity().ZoneAbyss) EnhancedDarknessSystem.lights.Add(new() { center = projectile.Center, scale = 1 }); - if (projectile.bobber && projectile.type != ProjectileType() && RunFishingMinigames(projectile) && !Main.LocalPlayer.dead) + // 24DEC2025: Ozzatron: victide bobber culled with SSO + if (projectile.bobber /*&& projectile.type != ProjectileType()*/ && RunFishingMinigames(projectile) && !Main.LocalPlayer.dead) return false; + //Reset the Homing Target immediately before AI can re-set it on applicable projectiles HomingTarget = -1; #region Vanilla Summons AI Changes @@ -2933,6 +2949,7 @@ namespace CalamityMod.Projectiles public float PersistentFishingData = -1; /// public Vector2 PersistentFishingDataVector2 = Vector2.Zero; + public bool RunFishingMinigames(Projectile projectile) { var owner = Main.player[projectile.owner]; @@ -2941,12 +2958,6 @@ namespace CalamityMod.Projectiles bool reelingIn = projectile.ai[0] == 1; bool lineSnapped = projectile.ai[0] == 2; - //Make sure Victide Snail actually fishes when using a minigame rod - foreach (var item in Main.ActiveProjectiles) - { - if (item.type == ProjectileType() && item.owner == projectile.owner) - item.ModProjectile().PlayerFishingTimer = 600; - } #region Utilities void SmallSplashAtOffset(Vector2 offset) { @@ -3291,7 +3302,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)); } @@ -3685,7 +3696,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)); } @@ -3749,22 +3760,27 @@ namespace CalamityMod.Projectiles } bool pulledNPC = Main.rand.NextBool(TrustyOldRod.enemyChance.Item1, TrustyOldRod.enemyChance.Item2); + if (owner.HeldItem.type == ModContent.ItemType() && reelingIn && projectile.ai[1] != 0 && projectile.localAI[1] != 0 && pulledNPC) { // Remove any item you would have fished up projectile.ai[1] = 0; // Get rarity of pull - int rarity = 0; + int rarity; int roll = Main.rand.Next(1, 100 + 1); if (roll == 1) rarity = 3; // UltraRare (1/100) else if (roll <= 21) rarity = 2; // Rare ~(1/5) else rarity = 1; // Common ~(4/5) - TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.whoAmI, rarity, projectile.lavaWet, projectile.honeyWet); + if (Main.netMode == NetmodeID.MultiplayerClient && Main.myPlayer == owner.whoAmI) + TrustyOldRodEnemyPacket.Send(owner, projectile.identity, rarity, projectile.lavaWet, projectile.honeyWet); + else if(Main.netMode == NetmodeID.SinglePlayer) + TrustyOldRodEnemySystem.SpawnTrustyOldRodNPC(owner, projectile.identity, rarity, projectile.lavaWet, projectile.honeyWet); + + TrustyOldRodEnemySystem.DoTrustyOldRodVFX(owner, projectile.identity, rarity, projectile.lavaWet, projectile.honeyWet); projectile.ai[0] = 2; // snap line return false; } - return false; } #endregion @@ -3960,10 +3976,6 @@ namespace CalamityMod.Projectiles } #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) { @@ -4621,15 +4633,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; @@ -4637,13 +4649,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 @@ -4805,7 +4817,8 @@ namespace CalamityMod.Projectiles Main.projectile[soul].tileCollide = false; if (soul.WithinBounds(Main.maxProjectiles)) Main.projectile[soul].DamageType = DamageClass.Generic; - } + Main.projectile[soul].ArmorPenetration = 20; + } extorterBoost = false; } } @@ -4816,9 +4829,17 @@ namespace CalamityMod.Projectiles #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 diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 0b25818a53..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) }, @@ -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) }, @@ -200,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) }, @@ -555,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/CountermeasureMittHoldout.cs b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs index 22a4bd3c7a..1411585c5f 100644 --- a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs +++ b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs @@ -73,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/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/StormlionSentryBullet.cs b/Projectiles/Enemy/StormlionSentryBullet.cs deleted file mode 100644 index 5802fe3a03..0000000000 --- a/Projectiles/Enemy/StormlionSentryBullet.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Enemy -{ - public class StormlionSentryBullet : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.hostile = true; - Projectile.timeLeft = 160; - Projectile.extraUpdates = 6; - Projectile.tileCollide = true; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - public override void AI() - { - Lighting.AddLight(Projectile.Center, Effects.StormlionEffects.EnergyColor.ToVector3() * 0.3f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Main.rand.NextBool()) - { - int dustStyle = ModContent.DustType(); - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle); - dust2.scale = Main.rand.NextFloat(0.4f, 0.7f); - dust2.velocity = Projectile.velocity * Main.rand.NextFloat(0.6f, 1f); - dust2.noGravity = true; - dust2.color = Effects.StormlionEffects.EnergyColor; - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 60); - } - public override void OnKill(int timeLeft) - { - - } - public override bool PreDraw(ref Color lightColor) - { - Asset orb = ModContent.Request("CalamityMod/Particles/BloomCircle"); - - for (int i = 0; i < 4; i++) - { - Vector2 scale = Projectile.scale * new Vector2(0.2f, 1.4f) * (0.05f + i * 0.02f) * 4; - Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition, null, Effects.StormlionEffects.EnergyColor with { A = 0 }, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); - } - return false; - } - } -} diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index 128d8bb152..25ae1dbf55 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -103,6 +104,12 @@ namespace CalamityMod.Projectiles.Enemy public override bool CanHitPlayer(Player target) => Projectile.ai[0] >= 60f && Projectile.ai[0] <= (Projectile.ai[1] == 1f ? 735f : 540f); + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 120, true); + } + public override bool PreDraw(ref Color lightColor) { float aiTrackCheck = Projectile.ai[1] == 1f ? 795f : 600f; diff --git a/Projectiles/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/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/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/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/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/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/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/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/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/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/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/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/EvilSmasherProjectile.cs b/Projectiles/Melee/EvilSmasherProjectile.cs index 5af5c7e264..d7708dd214 100644 --- a/Projectiles/Melee/EvilSmasherProjectile.cs +++ b/Projectiles/Melee/EvilSmasherProjectile.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Melee 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; @@ -52,14 +54,13 @@ 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))); + CurrentChargeMult = timer / (float)(StartupTime-1); Owner.velocity.X *= 0.97f; } if (inStartup && !Owner.channel && timer > 30) @@ -98,27 +99,27 @@ 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); 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); } @@ -137,9 +138,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) @@ -157,7 +162,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++) { @@ -180,8 +185,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, 900, CurrentChargeMult)); + Owner.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, CurrentChargeMult)); } public override bool PreDraw(ref Color lightColor) @@ -189,7 +195,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/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs index fd26bc727a..f7a5b243a0 100644 --- a/Projectiles/Melee/LightspeedDashHitbox.cs +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -72,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/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 e0215e4913..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; @@ -117,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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 index 3433fc25f1..2873b4aea4 100644 --- a/Projectiles/Ranged/OmniGrenade.cs +++ b/Projectiles/Ranged/OmniGrenade.cs @@ -87,10 +87,14 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 240f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 180f; - else modifiers.SourceDamage.Flat += 120f; + 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) diff --git a/Projectiles/Ranged/OmniGunHoldout.cs b/Projectiles/Ranged/OmniGunHoldout.cs index 6a5c6f65a4..c836aabdbc 100644 --- a/Projectiles/Ranged/OmniGunHoldout.cs +++ b/Projectiles/Ranged/OmniGunHoldout.cs @@ -82,7 +82,8 @@ namespace CalamityMod.Projectiles.Ranged OffsetLengthFromArm -= 20f; CurrentRecoilResolveSpeed = 0.14f; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), (int)(Projectile.damage * 6f), Projectile.knockBack, Projectile.owner); + 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; } @@ -115,7 +116,8 @@ namespace CalamityMod.Projectiles.Ranged framesBetweenShots = 8; OffsetLengthFromArm -= 3f; CurrentRecoilResolveSpeed = 0.3f; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + 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; @@ -155,9 +157,11 @@ namespace CalamityMod.Projectiles.Ranged // Propel the owner backward Owner.velocity += -Projectile.velocity * 7f; - - 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); + 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; @@ -190,8 +194,8 @@ namespace CalamityMod.Projectiles.Ranged #endregion OffsetLengthFromArm -= 24f; CurrentRecoilResolveSpeed = 0.15f; - - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 9f), Projectile.knockBack, Projectile.owner); + 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; } 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/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/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 fbf7c948a3..8a5ecd429c 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.alpha += (Projectile.Calamity().stealthStrike ? 11 : 17); + Projectile.alpha += (Projectile.ai[2] > 0f ? 9 : 17); if (Projectile.alpha >= 255) { Projectile.Kill(); diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 21c1045017..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/ElephantKillerThrown.cs b/Projectiles/Rogue/ElephantKillerThrown.cs index 9fd937049e..e2dcbb4116 100644 --- a/Projectiles/Rogue/ElephantKillerThrown.cs +++ b/Projectiles/Rogue/ElephantKillerThrown.cs @@ -496,7 +496,7 @@ namespace CalamityMod.Projectiles.Rogue for (int index = 0; index < Main.npc.Length; index++) { NPC target = Main.npc[index]; - if (!target.dontTakeDamage && target.active && target.life > 0) + 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 _); @@ -522,7 +522,7 @@ namespace CalamityMod.Projectiles.Rogue { resetHits = true; Projectile.numHits = 0; } float minMult = 0.1f; - int hitsToMinMult = 4; + int hitsToMinMult = 5; float damageFalloff = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); float adjustedDamageMult = damageMult * damageFalloff; 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/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/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/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/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index eb4fbebd69..d6a3686639 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -1,8 +1,4 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,98 +8,29 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; - public ref float Timer => ref Projectile.ai[0]; - public ref float BounceCheck => ref Projectile.ai[1]; - private const int Pierce = 2; public override void SetDefaults() { Projectile.width = 30; Projectile.height = 28; Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; - Projectile.penetrate = Pierce; - Projectile.timeLeft = 600; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 25; + Projectile.penetrate = -1; + Projectile.aiStyle = ProjAIStyleID.Boomerang; + Projectile.timeLeft = 300; + AIType = ProjectileID.Bananarang; } - public override void AI() - { - Timer++; - Projectile.rotation += BounceCheck > 0f ? 0.35f : 0.2f; - // Bouncing resets the timer for use in fading in its glow - if (Timer >= 30f || BounceCheck > 0f) - { - if (BounceCheck > 0f && Projectile.Calamity().stealthStrike) - Projectile.velocity *= 0.975f; - else - { - Projectile.velocity.X *= BounceCheck > 0f ? 0.985f : 0.998f; - Projectile.velocity.Y += 0.0375f; - } - } - if (Projectile.velocity.Y > 8f) - Projectile.velocity.Y = 8f; - - // Random dust after bouncing - if (BounceCheck > 0f || Projectile.Calamity().stealthStrike) - { - Vector2 dustPos = Projectile.Center + Main.rand.NextVector2CircularEdge(20f, 15f); - Vector2 dustVel = Utils.DirectionTo(Projectile.Center, dustPos).RotatedBy(MathHelper.PiOver2) * 2f; - Dust dust = Dust.NewDustPerfect(dustPos, DustID.Sand, dustVel, Scale: 0.75f); - dust.noGravity = true; - } - } - public override bool? CanDamage() => BounceCheck > 0f && Projectile.Calamity().stealthStrike ? false : null; - public override bool OnTileCollide(Vector2 oldVelocity) { - // Should only bounce if it hasn't bounced before, hasn't pierced an enemy, and is hitting a floor (moving downwards) - if (BounceCheck == 0f && (Projectile.penetrate == Pierce || Projectile.Calamity().stealthStrike) && Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 0f) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) { - BounceCheck = 1f; - Timer = 0f; - Projectile.penetrate = 1; Projectile.velocity.Y = -oldVelocity.Y; - if (Projectile.velocity.Y < -4f) - Projectile.velocity.Y = -4f; - - // Summon a duststorm on stealth strikes - if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, 1f, Projectile.owner, Projectile.whoAmI); - } - return false; } - return true; - } - - public override void OnKill(int timeLeft) - { - for (int s = 0; s < 8; s++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Scale: 0.9f); - dust.noGravity = true; - } - - if (BounceCheck > 0f && Main.myPlayer == Projectile.owner) - { - for (int i = 1; i <= 3; i++) - { - Vector2 velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3f, 4.5f); - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner, i); - Main.projectile[p].rotation = Main.rand.NextFloat(MathHelper.TwoPi); - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = TextureAssets.Projectile[Type].Value; - Vector2 stretch = new Vector2(MathHelper.Lerp(1.2f, 0.8f, (float)Math.Abs(Math.Sin(Projectile.rotation))), MathHelper.Lerp(0.85f, 1.15f, (float)Math.Abs(Math.Sin(Projectile.rotation)))); - Color drawColor = BounceCheck > 0f ? Color.Lerp(lightColor, Color.White, MathHelper.Clamp(Timer / 60f, 0f, 0.5f)) : lightColor; - - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, tex.Size() / 2f, stretch, SpriteEffects.None); return false; } } diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index 1a7b49c931..43d46d25de 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -1,74 +1,56 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class SandDollarStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Typeless/SandCloakVeil"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; - private const float Radius = 96f; - private const int StartTime = 180; - private bool shouldDie = false; public override void SetDefaults() { Projectile.width = 30; Projectile.height = 28; Projectile.DamageType = RogueDamageClass.Instance; Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = StartTime; - Projectile.Opacity = 0f; + Projectile.aiStyle = ProjAIStyleID.Boomerang; + Projectile.timeLeft = 300; + AIType = ProjectileID.Bananarang; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } - public override void AI() - { - Projectile disk = Main.projectile[(int)Projectile.ai[0]]; - Projectile.rotation += 0.025f; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(); - if (disk.active) + public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(); + + private void OnHitEffects() + { + int coralAmt = Main.rand.Next(1, 4); + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { - if (!shouldDie) + for (int coralCount = 0; coralCount < coralAmt; coralCount++) { - Projectile.Center = disk.Center + disk.velocity; - Projectile.timeLeft = 20; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); } - } - else - shouldDie = true; - - if (Projectile.timeLeft >= 20) - Projectile.Opacity += 0.05f; - else - Projectile.Opacity -= 0.05f; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); - public override bool PreDraw(ref Color lightColor) + public override bool OnTileCollide(Vector2 oldVelocity) { - Texture2D tex = TextureAssets.Projectile[Type].Value; - float scaleStep = 0.05f; - Color drawCol = Projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f)); - float drawTransparency = 0.2f; - - if (Projectile.timeLeft > StartTime - 20) - drawTransparency *= Utils.GetLerpValue(StartTime - 20, StartTime, Projectile.timeLeft, true); - else if (Projectile.timeLeft < 20) - drawTransparency *= Utils.GetLerpValue(0, 20, Projectile.timeLeft, true); - - for (int i = 0; i < 20; i++) + Projectile.ai[0] += 0.1f; + if (Projectile.velocity.X != oldVelocity.X) { - float rotation = (Projectile.rotation + scaleStep * i) * (i % 2 == 0).ToDirectionInt(); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, rotation, tex.Size() / 2f, (Radius * 0.0044f) - (i * scaleStep), SpriteEffects.None); + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; } return false; } diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 0847680f32..b19026c624 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -1,8 +1,4 @@ -using CalamityMod.Dusts; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,101 +8,85 @@ namespace CalamityMod.Projectiles.Rogue public class SeafoamBombProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int time = 0; - public bool notTheClone => Projectile.Calamity().stealthStrike && Projectile.ai[0] == 0; // If the bomb is the initial thrown stealth strike bomb and not a split public override void SetDefaults() { - Projectile.width = Projectile.height = 38; + Projectile.width = 14; + Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 400; + Projectile.timeLeft = 240; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 1; } public override void AI() { - Projectile.spriteDirection = Projectile.direction; - float dustscaleMult = 1; - if (notTheClone) - { - Projectile.scale = 1.15f; - Projectile.extraUpdates = 2; - dustscaleMult = 1.5f; - } - if (time > 25) - { - Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; - if (Projectile.velocity.Y > 0) - Projectile.velocity.X = Projectile.velocity.X * 0.975f; - } - Projectile.rotation += Projectile.velocity.X * 0.07f + Projectile.direction * 0.07f; - - Vector2 dustPos = Projectile.Center + (Vector2.UnitY * -22 * Projectile.scale).RotatedBy(Projectile.rotation - (MathHelper.PiOver2 + 0.4f) * Projectile.spriteDirection); - Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(0.15f, 0.35f)); - dust2.noGravity = true; - dust2.scale = Main.rand.NextFloat(0.4f, 0.55f) * dustscaleMult; - dust2.color = Color.Lerp(Color.Cyan, Color.Turquoise, Main.rand.NextFloat(0, 0.7f)); - if (Main.rand.NextBool(5)) - { - Dust dust = Dust.NewDustPerfect(dustPos, ModContent.DustType(), Projectile.velocity.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.65f, 0.85f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.7f, 1f) * dustscaleMult; - dust.color = Color.Lerp(Color.Cyan, Color.Turquoise, Main.rand.NextFloat(0, 0.7f)); - } - - time++; - Lighting.AddLight(Projectile.Center, Color.DodgerBlue.ToVector3() * 0.3f * dustscaleMult); + Projectile.rotation += Projectile.velocity.X * 0.1f; + Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; + Projectile.velocity.X = Projectile.velocity.X * 0.99f; } public override void OnKill(int timeLeft) { - if (notTheClone) // Split into a few normal bombs that have reduced damage - { - for (int i = 0; i < 15; i++) - { - Vector2 randVel = new Vector2(7, 7).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.8f, 1.6f); - Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.SlateGray * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); - GeneralParticleHandler.SpawnParticle(smoke); - } + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = Projectile.Calamity().stealthStrike ? 256 : 128; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - float throwCount = Projectile.localAI[0]; - if (Main.myPlayer == Projectile.owner) + for (int i = 0; i < (Projectile.Calamity().stealthStrike ? 5 : 1); i++) + { + float posX = Projectile.Center.X + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); + float posY = Projectile.Center.Y + (Projectile.Calamity().stealthStrike ? Main.rand.Next(-50, 51) : 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); + } + + if (Main.netMode != NetmodeID.Server) + { + Vector2 goreSource = Projectile.Center; + int goreAmt = Projectile.Calamity().stealthStrike ? 6 : 3; + Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) { - for (int i = 0; i < 8; i++) + float velocityMult = 0.33f; + if (goreIndex < (goreAmt / 3)) { - throwCount++; - Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); - int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].localAI[0] = throwCount; - Main.projectile[stealth].ai[0] = 1; - Main.projectile[stealth].extraUpdates = 3; + velocityMult = 0.66f; } - } - - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = -0.3f, Volume = 0.8f }, Projectile.Center); - } - else // Normal bubble spawn - { - Projectile bubble = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f, -5f); - bubble.localAI[0] = Projectile.localAI[0]; - SoundEngine.PlaySound(SoundID.Item14 with { Pitch = Main.rand.NextFloat(0.15f, 0.3f), Volume = 0.6f, MaxInstances = 10 }, Projectile.Center); - } - } - public override bool PreDraw(ref Color lightColor) - { - Asset tex = ModContent.Request(Texture); - if (notTheClone) - { - for (int i = 0; i < 25; i++) - { - Color auraColor = Color.Turquoise with { A = 0 } * 0.35f; - Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 3; - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + if (goreIndex >= (2 * goreAmt / 3)) + { + velocityMult = 1f; + } + Mod mod = ModContent.GetInstance(); + int type = Main.rand.Next(61, 64); + int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + type = Main.rand.Next(61, 64); + smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; } } - return true; } - public override bool? CanDamage() => (!notTheClone && Projectile.Calamity().stealthStrike && time < 30) ? false : null; // Dont have the cluster bomb splits detonate on enemies right when they spawn } } diff --git a/Projectiles/Rogue/SeafoamBombProj.png b/Projectiles/Rogue/SeafoamBombProj.png index b12539c68c..128c4f76bb 100644 Binary files a/Projectiles/Rogue/SeafoamBombProj.png and b/Projectiles/Rogue/SeafoamBombProj.png differ diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index 5cd7cf61a0..d33e0aa2b0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -1,9 +1,4 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -14,199 +9,59 @@ namespace CalamityMod.Projectiles.Rogue public class SeafoamBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public ref float time => ref Projectile.ai[0]; - public ref float bubbleLevel => ref Projectile.ai[1]; // -1 = small bubble, 0 = fusing bubble, 1 = big bubble - public bool startEffects = true; // Spawn effects - public float radius => 40 * Projectile.scale; - public bool canHit = false; // Only the small bubbles can directly hit enemies - public Projectile fuseGoal; // The bubble to fuse with - public NPC targeted; // The enemy to home in on as a small bubble - - public override void SetStaticDefaults() => Main.projFrames[Type] = 2; + public override string Texture => "CalamityMod/Projectiles/Typeless/CoralBubble"; public override void SetDefaults() { - Projectile.width = Projectile.height = 32; + Projectile.width = 28; + Projectile.height = 28; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.timeLeft = 180; Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.scale = 1f; + Projectile.localNPCHitCooldown = 30; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.ArmorPenetration = 15; } + public override void AI() { - // All the on spawn effects, also happens when a mid bubble becomes a big bubble - if (startEffects) + Projectile.ai[0] += 1f; + if (Projectile.alpha < 50) { - if (bubbleLevel == 0) - { - canHit = false; - for (int i = 0; i < 5; i++) - { - Vector2 vel = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 6f * (i % 2 == 0 ? 0.88f : 1f); - Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1.6f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); - GeneralParticleHandler.SpawnParticle(sparks); - } - } - if (bubbleLevel == 1) - { - Projectile.extraUpdates = 2; - Projectile.timeLeft = 180; - Projectile.velocity = Vector2.UnitY * -1.5f; - canHit = false; - for (int i = 0; i < 10; i++) - { - Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 8f * (i % 2 == 0 ? 0.88f : 1f); - Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1.6f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); - GeneralParticleHandler.SpawnParticle(sparks); - } - } - if (bubbleLevel == -1) - { - Projectile.scale = 0.6f; - canHit = true; - } - startEffects = false; + Projectile.alpha = 50; } - - // Mid - if (bubbleLevel == 0) + else if (Projectile.alpha > 50) { - Projectile.scale = 1f; - float distance = 500; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile != Projectile && Vector2.Distance(Projectile.Center, projectile.Center) < distance && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Projectile.owner) - { - distance = Vector2.Distance(Projectile.Center, projectile.Center); - fuseGoal = projectile; - } - } - if (fuseGoal != null) - { - if (Projectile.velocity.Length() < 5) - Projectile.velocity = Projectile.velocity * 0.99f + Utils.DirectionTo(Projectile.Center, fuseGoal.Center) * 0.03f; - else - Projectile.velocity *= 0.995f; - - if (Utils.Distance(Projectile.Center, fuseGoal.Center) < radius) - { - if (fuseGoal.localAI[0] > Projectile.localAI[0]) - { - fuseGoal.localAI[0] = -5; - fuseGoal.Kill(); - Projectile.ai[1]++; - startEffects = true; - } - } - - if (!fuseGoal.active || fuseGoal.ai[1] != 0) - fuseGoal = null; - } - else if (Projectile.velocity.Length() > 2) - Projectile.velocity *= 0.99f; - - if (Projectile.velocity.Y > -2) - Projectile.velocity.Y -= 0.012f; + Projectile.alpha -= 10; } - // Large - if (bubbleLevel == 1) + Projectile.scale += 0.002f; + if (Projectile.ai[0] % 60 == 0) { - Projectile.scale = 1f; - Projectile.velocity *= 0.99f; + Projectile.damage *= 2; } - // Small - if (bubbleLevel == -1) - { - if (targeted == null || !targeted.active || targeted.life <= 0) - targeted = Projectile.Center.ClosestNPCAt(500); - if (time > 90) - { - Projectile.extraUpdates = 2; - if (targeted == null) - { - if (Projectile.velocity.Y > -3) - Projectile.velocity.Y -= 0.02f; - } - else - CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(700), false, 0.18f, 7, 0.98f, accelerate: true); - } - else - { - Projectile.velocity *= 0.99f; - Projectile.velocity.Y -= 0.027f; - } - } - - if (Projectile.ai[1] == -1) - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(Projectile.Center, Color.Turquoise.ToVector3() * 0.3f * Projectile.scale); - time++; - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - target.AddBuff(ModContent.BuffType(), 60); } + public override void OnKill(int timeLeft) { - float miniBubbles = 0; - if (bubbleLevel == 0) - miniBubbles = 2; - if (bubbleLevel == 1) - miniBubbles = 5; - if (bubbleLevel == -1) + SoundEngine.PlaySound(SoundID.Item54, Projectile.position); + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + int inc; + for (int i = 0; i < 25; i = inc + 1) { - SoundEngine.PlaySound(SoundID.Item54 with { MaxInstances = 6 }, Projectile.Center); - for (int i = 0; i < 2; i++) - { - Vector2 vel = (Vector2.One * 2).RotatedByRandom(Math.PI); - Particle sparks = new VelChangingSpark(Projectile.Center, (vel * Main.rand.NextFloat(1f, 2.4f)).RotatedByRandom(0.35f), Vector2.UnitY * -6, "CalamityMod/Particles/BloomRing", Main.rand.Next(28, 32 + 1), Main.rand.NextFloat(0.15f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, new Vector2(1f, 1), true, false, 0, false, 0.065f, 0.13f); - GeneralParticleHandler.SpawnParticle(sparks); - } - } - else - { - SoundStyle sound = new("CalamityMod/Sounds/Custom/BubblyPop"); - SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.7f, 0.9f) - Projectile.scale * 0.6f, MaxInstances = 10 }, Projectile.Center); - - float blastSize = 70 + 70 * bubbleLevel; - float minMultiplier = 0.25f; - int hitsToMinMult = 5; - int debuff1 = ModContent.BuffType(); - int debuffTime = 180; - if (Projectile.localAI[0] >= 0 && Main.myPlayer == Projectile.owner) // On kill but exclude small bubbles and bubbled that died in a fuse - { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.localAI[0] = debuff1; - blast.localAI[1] = debuffTime; - blast.DamageType = RogueDamageClass.Instance; - - for (int i = 0; i < miniBubbles; i++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Vector2.One * 1.5f).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.9f, 1.6f) + Vector2.UnitY * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), Projectile.knockBack / 5, Projectile.owner, 0, -1); - - } - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f * Projectile.scale, 0.65f * Projectile.scale, 20); - GeneralParticleHandler.SpawnParticle(blastRing2); + int waterDust = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Rain, 0f, 0f, 0, default, 1f); + Main.dust[waterDust].position = (Main.dust[waterDust].position + Projectile.position) / 2f; + Main.dust[waterDust].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Main.dust[waterDust].velocity.Normalize(); + Dust dust = Main.dust[waterDust]; + dust.velocity *= (float)Main.rand.Next(1, 30) * 0.1f; + Main.dust[waterDust].alpha = Projectile.alpha; + inc = i; } } - public override bool PreDraw(ref Color lightColor) - { - float sine = (float)Math.Sin(time * Projectile.scale * 0.275f / MathHelper.Pi); - float sizeMult = ((sine + 2) * 0.05f); - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.ai[1] == 1 ? 1 : 0); - - Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 2, 6, 1, 0.7f), Utils.Remap(Projectile.velocity.Length(), 2, 6, 1, 2f)); - - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, squash * (Projectile.scale + sizeMult), SpriteEffects.None, 0); - return false; - } - public override bool? CanCutTiles() => false; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => canHit ? CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox) : false; } } diff --git a/Projectiles/Rogue/SeafoamBubble.png b/Projectiles/Rogue/SeafoamBubble.png deleted file mode 100644 index f7b27cd5c1..0000000000 Binary files a/Projectiles/Rogue/SeafoamBubble.png and /dev/null differ diff --git a/Projectiles/Rogue/SealedSingularityProjectile.cs b/Projectiles/Rogue/SealedSingularityProjectile.cs index a3d2e00f8f..ea68e347b6 100644 --- a/Projectiles/Rogue/SealedSingularityProjectile.cs +++ b/Projectiles/Rogue/SealedSingularityProjectile.cs @@ -1,5 +1,7 @@ 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; @@ -15,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SealedSingularityProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; @@ -98,6 +101,11 @@ namespace CalamityMod.Projectiles.Rogue } 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( @@ -136,8 +144,6 @@ namespace CalamityMod.Projectiles.Rogue if (Timer > TimerMax && AIState == 0) { var sizee = Stealth ? 900 : 600; - Projectile.localNPCHitCooldown = 30; - Projectile.ResetLocalNPCHitImmunity(); Projectile.tileCollide = false; Timer = 0; TimerMax = Stealth ? 600 : 300; @@ -150,6 +156,7 @@ namespace CalamityMod.Projectiles.Rogue Timer = 0; TimerMax = 300; Projectile.ResetLocalNPCHitImmunity(); + Projectile.numHits = 0; if (Main.myPlayer == Projectile.owner) for (int index = 0; index < 3; ++index) { @@ -164,6 +171,7 @@ namespace CalamityMod.Projectiles.Rogue if (Timer >= TimerMax && AIState == 2) { Projectile.Resize(300, 300); + Projectile.numHits = 0; Projectile.ResetLocalNPCHitImmunity(); Projectile.Damage(); @@ -334,10 +342,12 @@ namespace CalamityMod.Projectiles.Rogue switch (AIState) { case 1: - modifiers.SourceDamage /= 20; + modifiers.SourceDamage /= Stealth ? 15 : 25; + modifiers.SourceDamage *= MathF.Pow(1 - SealedSingularity.FalloffPerTargetHitByAura, Projectile.numHits); return; case 2: - modifiers.SourceDamage *= 2; + modifiers.SourceDamage *= Stealth ? 5 : 2; + modifiers.SourceDamage *= MathF.Pow(1 - SealedSingularity.FallofPerTargetHitByBomb, Projectile.numHits); return; } } 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/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/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..2b6874179d 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, 30); + + if (MinionCount >= 2f) + target.AddBuff(BuffID.CursedInferno, 30); + if (MinionCount >= 3f) + target.AddBuff(BuffID.Venom, 30); + 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, 30); + target.AddBuff(ModContent.BuffType(), 30); } } } 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/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/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/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/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/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/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 index f3e16d1e25..f9927fe359 100644 --- a/Projectiles/Typeless/Elumphant.cs +++ b/Projectiles/Typeless/Elumphant.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Typeless public void SetElumphantPower() { int usedDefense = Owner.Calamity().frozenCubeUsedDefense; - if (time == 0) // Show the player how much defense is being used + if (time == 0 && !Owner.Calamity().frozenCubeVanity) // Show the player how much defense is being used CombatText.NewText(Projectile.Hitbox, color2, -usedDefense,false, true); frozenCubePower = usedDefense * 0.05f; // 1 point of defense = 5% effectiveness @@ -598,6 +598,11 @@ namespace CalamityMod.Projectiles.Typeless attackTimer = 0; attackTimer += recoiling ? -0.75f : 1 + 0.4f * Projectile.numHits; + if (Owner.Calamity().frozenCubeVanity) + { + fxFade = 0; + attackTimer = 0; + } time++; if (mammothOops) hopTimer++; @@ -611,7 +616,7 @@ namespace CalamityMod.Projectiles.Typeless lastProjPos = Projectile.Center; - if (!Owner.Calamity().frozenCube) + if (!Owner.Calamity().frozenCube && !Owner.Calamity().frozenCubeVanity) { if (SoundEngine.TryGetActiveSound(soundSlot, out var sound2) && sound2.IsPlaying) sound2?.Stop(); diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index 1e56f608aa..06f3bf0936 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -16,15 +16,6 @@ namespace CalamityMod.Projectiles.Typeless public override int DustType => 108; } - public class EutrophicSandBallFalling : SandBall - { - public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallEutrophic"; - public override bool Fired => false; - public override int TileType => ModContent.TileType(); - public override int ItemType => ModContent.ItemType(); - public override int DustType => DustID.Titanium; - } - public class DunesandBallFalling : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune"; diff --git a/Projectiles/Typeless/VictideBarrier.cs b/Projectiles/Typeless/VictideBarrier.cs deleted file mode 100644 index 7ee97c9e22..0000000000 --- a/Projectiles/Typeless/VictideBarrier.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Cooldowns; -using CalamityMod.Items.Armor.Victide; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using static CalamityMod.CalamityUtils; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VictideBarrier : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/BubblyBurst"); - - public static float ExplosionLifetime = 24f; - public static float MaxScale = 6f; - - public static float DashSpeed = 24f; // 24 tiles - public static float DashLifetime = 16f; - public static int DashSlamIFrames = 12; - private List NPCsHitBySlam = new List() { -1 }; - - public ref float ExplodeTimer => ref Projectile.ai[0]; - public ref float DashTimer => ref Projectile.ai[1]; - public ref float HealTimer => ref Projectile.ai[2]; - public Player Owner => Main.player[Projectile.owner]; - - public static Asset Shine; - public static Asset Explosion; - public override void Load() - { - Shine = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); - Explosion = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion"); - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 20; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = (int)ExplosionLifetime; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.rotation = MathHelper.ToRadians(Main.GlobalTimeWrappedHourly * 36f); - - if (ExplodeTimer > 0f) - { - float scaleLevel = PiecewiseAnimation(ExplodeTimer / ExplosionLifetime, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); - Projectile.scale = MathHelper.Lerp(1f, MaxScale, scaleLevel); - Projectile.Opacity = MathF.Sin(MathHelper.PiOver2 + MathHelper.PiOver2 * ExplodeTimer / ExplosionLifetime); - - if (ExplodeTimer == 1f) - { - SoundEngine.PlaySound(ExplosionSound, Projectile.Center); - - for (int i = 0; i < 5; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * Main.rand.NextFloat(10f, 12f) * (i % 2 == 0 ? 0.88f : 1f); - Particle bub = new VelChangingSpark(Projectile.Center, velocity.RotatedByRandom(MathHelper.Pi / 10f), Vector2.UnitY * -6f, "CalamityMod/Particles/BloomRing", Main.rand.Next(36, 42 + 1), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, Vector2.One, shrinkSpeed: 0.08f); - GeneralParticleHandler.SpawnParticle(bub); - } - } - - if (ExplodeTimer == 6f) - { - for (int i = 0; i < 8; i++) - { - Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2.5f, 5.5f); - float smokeScale = Main.rand.NextFloat(1.6f, 2f); - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.PaleTurquoise, 18, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); - GeneralParticleHandler.SpawnParticle(smoke); - } - } - - ExplodeTimer++; - } - else if (DashTimer > 0f) - { - Owner.mount?.Dismount(Owner); - Owner.RemoveAllGrapplingHooks(); - - Owner.velocity = Projectile.velocity; - Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); - - // Move the player to the projectile, allowing them to bypass platforms (but not tiles) - Owner.Center = Projectile.Center; - - // Custom ram effect, similar to the one used in CalamityPlayerDashEffects - Rectangle hitArea = new Rectangle((int)(Owner.position.X + Owner.velocity.X * 0.5 - 4f), (int)(Owner.position.Y + Owner.velocity.Y * 0.5 - 4), Owner.width + 8, Owner.height + 8); - foreach (NPC n in Main.ActiveNPCs) - { - // Ignore critters with the Guide to Critter Companionship - if (Owner.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) - continue; - - if (!n.dontTakeDamage && !n.friendly && !NPCsHitBySlam.Contains(n.whoAmI)) - { - if (hitArea.Intersects(n.getRect()) && (n.noTileCollide || Owner.CanHit(n))) - { - Projectile.NewProjectile(Owner.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, n.whoAmI); - Owner.GiveImmuneTimeForCollisionAttack(DashSlamIFrames); - NPCsHitBySlam.Add(n.whoAmI); - } - } - } - - // Dash trail effects - Color trailColor = Color.Lerp(Color.Cyan, Color.RoyalBlue, DashTimer / DashLifetime); - if (DashTimer % 2f == 1f) - { - Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity * 2f, Projectile.velocity * 0.5f, "CalamityMod/Particles/ForwardSmear", false, 12, 0.2f, trailColor, new Vector2(1f, Main.rand.NextFloat(1.2f, 1.35f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f)); - GeneralParticleHandler.SpawnParticle(trail); - } - for (int direction = -1; direction <= 1; direction += 2) - { - Vector2 sidePos = Projectile.Center - Projectile.velocity * 2f + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * direction) * Utils.Remap(DashTimer, 1f, DashLifetime, 48f, 24f); - Particle sideTrail = new CustomSpark(sidePos, Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 18, 0.3f, trailColor * 0.6f, new Vector2(1f, 2.5f), shrinkSpeed: 0.2f); - GeneralParticleHandler.SpawnParticle(sideTrail); - } - - DashTimer++; - } - else - { - // If the barrier set isn't on, unceremoniously disappear - if (!Owner.Calamity().victideBarrierSet || Owner.dead || !Owner.active) - { - Projectile.Kill(); - Owner.Calamity().victideBarrierHeal = 0; - return; - } - // Set to dash if cooldown is detected and also create an explosion in its place - if (Owner.HasCooldown(WardingWave.ID)) - { - DashTimer++; - Projectile.damage = (int)Owner.GetBestClassDamage().ApplyTo(VictideHeadBarrier.BarrierDamage); - Owner.Calamity().victideBarrierHeal = 0; - if (Projectile.owner == Main.myPlayer) - { - // Set dash velocity - Projectile.velocity = Owner.SafeDirectionTo(Main.MouseWorld) * DashSpeed; - Projectile.tileCollide = true; - - // Spawn explosion - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Vector2.Zero, Type, Projectile.damage, VictideHeadBarrier.BarrierExplosionKB, Projectile.owner, 1f); - } - } - - if (Owner.Calamity().victideBarrierHeal > 0) - { - HealTimer++; - if (HealTimer % VictideHeadBarrier.BarrierFramesPerHeal == VictideHeadBarrier.BarrierFramesPerHeal - 1) - { - Owner.Calamity().victideBarrierHeal--; - Owner.HealPlayer(1); - } - } - else - HealTimer = 0f; - - Lighting.AddLight(Owner.MountedCenter, Color.White.ToVector3() * 0.5f); - Projectile.Center = Owner.MountedCenter; - Projectile.timeLeft = (int)DashLifetime; - } - } - - public override void OnKill(int timeLeft) - { - if (DashTimer > 0f) - Owner.velocity *= 0.5f; - } - - // Explosion collision only (dash has a custom ram logic check effect) - public override bool? CanDamage() => ExplodeTimer > 0f ? null : false; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f * Projectile.scale, targetHitbox); - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); - modifiers.SourceDamage *= Utils.Remap(Projectile.numHits, 0, 10, 1f, 0.1f, true); - } - - public override bool PreDraw(ref Color lightColor) - { - if (DashTimer > 0f) - return false; - - Texture2D explosionTex = Explosion.Value; - Color barrierColor = Main.hslToRgb(0.6f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.5f); - - if (ExplodeTimer > 0f) - { - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Vector2 explosionPos = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(explosionTex, explosionPos, null, barrierColor * Projectile.Opacity, Projectile.rotation, explosionTex.Size() * 0.5f, 0.02f * Projectile.scale, SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - return false; - } - - Vector2 drawPos = Owner.Center + Vector2.UnitY * Owner.gfxOffY - Main.screenPosition; - Texture2D circleBase = TextureAssets.Projectile[Type].Value; - Color contrastingColor = Main.hslToRgb(0.6f + 0.1f * MathF.Cos(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.5f); - - // Silly solution to making a clean circle over the player - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.5f); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(barrierColor); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Transparent); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(0f); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply(); - - Main.EntitySpriteDraw(circleBase, drawPos, null, Color.White, 0f, circleBase.Size() * 0.5f, 80f, SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - - // Give it additional texture - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Main.EntitySpriteDraw(explosionTex, drawPos, null, contrastingColor * 0.3f, Projectile.rotation, explosionTex.Size() * 0.5f, 0.04f, SpriteEffects.None); - Texture2D shineTex = Shine.Value; - Main.EntitySpriteDraw(shineTex, drawPos, null, Color.HotPink * 0.5f, MathHelper.ToRadians(36f), shineTex.Size() * 0.5f, 0.45f, SpriteEffects.None); - Main.EntitySpriteDraw(shineTex, drawPos, null, Color.Orange * 0.3f, MathHelper.ToRadians(216f), shineTex.Size() * 0.5f, 0.55f, SpriteEffects.None); - Main.spriteBatch.ExitShaderRegion(); - return false; - } - } -} diff --git a/Projectiles/Typeless/VictideBobber.cs b/Projectiles/Typeless/VictideBobber.cs deleted file mode 100644 index 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/VanillaProjectileOverrides/CounterweightEffects.cs b/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs index a4d9a8d511..0d26e280e9 100644 --- a/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs +++ b/Projectiles/VanillaProjectileOverrides/CounterweightEffects.cs @@ -4,7 +4,11 @@ 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; @@ -26,9 +30,11 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides public override bool PreAI(Projectile projectile) { var player = Main.player[projectile.owner]; + int id = player.HeldItem.type; + if (!runInitialization) { - if (player.HeldItem.type == ModContent.ItemType()) + if (id == ModContent.ItemType()) projectile.MaxUpdates++; runInitialization = true; } @@ -38,8 +44,20 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { var player = Main.player[projectile.owner]; - if (player.HeldItem.type == ModContent.ItemType()) + 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/Scenes/MusicScenes/TheConcoctionMusicScene.cs b/Scenes/MusicScenes/TheConcoctionMusicScene.cs new file mode 100644 index 0000000000..45079987e4 --- /dev/null +++ b/Scenes/MusicScenes/TheConcoctionMusicScene.cs @@ -0,0 +1,18 @@ +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Scenes.MusicScenes +{ + public class TheConcoctionMusicScene : ModSceneEffect + { + public override bool IsSceneEffectActive(Player player) + { + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); + return (concoctionPlayer.swinesWrathCounter <= 600 && concoctionPlayer.swinesWrathCounter != -1); + } + public override int Music => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + } +} diff --git a/Schematics/Barbed_Stockade1.csch b/Schematics/Barbed_Stockade1.csch deleted file mode 100644 index 9d07e3aec6..0000000000 Binary files a/Schematics/Barbed_Stockade1.csch and /dev/null differ diff --git a/Schematics/Barbed_Stockade2.csch b/Schematics/Barbed_Stockade2.csch deleted file mode 100644 index c21b797d8a..0000000000 Binary files a/Schematics/Barbed_Stockade2.csch and /dev/null differ diff --git a/Schematics/Barbed_Stockade3.csch b/Schematics/Barbed_Stockade3.csch deleted file mode 100644 index eae4b2cb42..0000000000 Binary files a/Schematics/Barbed_Stockade3.csch and /dev/null differ diff --git a/Schematics/Barbed_Stockade4.csch b/Schematics/Barbed_Stockade4.csch deleted file mode 100644 index a49e0c86d5..0000000000 Binary files a/Schematics/Barbed_Stockade4.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache1.csch b/Schematics/Bonescrapper_Cache1.csch deleted file mode 100644 index d5411fa3e7..0000000000 Binary files a/Schematics/Bonescrapper_Cache1.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache2.csch b/Schematics/Bonescrapper_Cache2.csch deleted file mode 100644 index 1145d46c6e..0000000000 Binary files a/Schematics/Bonescrapper_Cache2.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache3.csch b/Schematics/Bonescrapper_Cache3.csch deleted file mode 100644 index cb90d99889..0000000000 Binary files a/Schematics/Bonescrapper_Cache3.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache4.csch b/Schematics/Bonescrapper_Cache4.csch deleted file mode 100644 index 21fa20a226..0000000000 Binary files a/Schematics/Bonescrapper_Cache4.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache5.csch b/Schematics/Bonescrapper_Cache5.csch deleted file mode 100644 index 09a4f5d4fa..0000000000 Binary files a/Schematics/Bonescrapper_Cache5.csch and /dev/null differ diff --git a/Schematics/Bonescrapper_Cache6.csch b/Schematics/Bonescrapper_Cache6.csch deleted file mode 100644 index 76ecd82c41..0000000000 Binary files a/Schematics/Bonescrapper_Cache6.csch and /dev/null differ diff --git a/Schematics/Brimstone_Atrium1.csch b/Schematics/Brimstone_Atrium1.csch deleted file mode 100644 index 257b3872c6..0000000000 Binary files a/Schematics/Brimstone_Atrium1.csch and /dev/null differ diff --git a/Schematics/Brimstone_Atrium2.csch b/Schematics/Brimstone_Atrium2.csch deleted file mode 100644 index a0b5250357..0000000000 Binary files a/Schematics/Brimstone_Atrium2.csch and /dev/null differ diff --git a/Schematics/Brimstone_Atrium3.csch b/Schematics/Brimstone_Atrium3.csch deleted file mode 100644 index 258c97d742..0000000000 Binary files a/Schematics/Brimstone_Atrium3.csch and /dev/null differ diff --git a/Schematics/Demonic_Dungeon1.csch b/Schematics/Demonic_Dungeon1.csch deleted file mode 100644 index 7b7595096d..0000000000 Binary files a/Schematics/Demonic_Dungeon1.csch and /dev/null differ diff --git a/Schematics/Demonic_Dungeon2.csch b/Schematics/Demonic_Dungeon2.csch deleted file mode 100644 index c8116e9d3d..0000000000 Binary files a/Schematics/Demonic_Dungeon2.csch and /dev/null differ diff --git a/Schematics/Hellstone_Stronghold1.csch b/Schematics/Hellstone_Stronghold1.csch deleted file mode 100644 index f7a79c9c73..0000000000 Binary files a/Schematics/Hellstone_Stronghold1.csch and /dev/null differ diff --git a/Schematics/Hellstone_Stronghold2.csch b/Schematics/Hellstone_Stronghold2.csch deleted file mode 100644 index f05f1d9ef6..0000000000 Binary files a/Schematics/Hellstone_Stronghold2.csch and /dev/null differ diff --git a/Schematics/Sanctum_of_Oblivion1.csch b/Schematics/Sanctum_of_Oblivion1.csch deleted file mode 100644 index 1746bf4e6b..0000000000 Binary files a/Schematics/Sanctum_of_Oblivion1.csch and /dev/null differ diff --git a/Schematics/Sanctum_of_Oblivion2.csch b/Schematics/Sanctum_of_Oblivion2.csch deleted file mode 100644 index 924291f7b7..0000000000 Binary files a/Schematics/Sanctum_of_Oblivion2.csch and /dev/null differ diff --git a/Schematics/Sanctum_of_Oblivion3.csch b/Schematics/Sanctum_of_Oblivion3.csch deleted file mode 100644 index 13e833b9e2..0000000000 Binary files a/Schematics/Sanctum_of_Oblivion3.csch and /dev/null differ diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index 71c79ad915..7701418c8a 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -16,66 +16,6 @@ namespace CalamityMod.Schematics internal const string ShimmerShrineKey = "Shimmer Shrine Key"; internal const string ShimmerShrineFilename = "Schematics/Shimmer_Shrine.csch"; - internal const string BrimstoneAtriumType1Key = "Brimstone Atrium Type 1 Key"; - internal const string BrimstoneAtriumType1Filename = "Schematics/Brimstone_Atrium1.csch"; - - internal const string BrimstoneAtriumType2Key = "Brimstone Atrium Type 2 Key"; - internal const string BrimstoneAtriumType2Filename = "Schematics/Brimstone_Atrium2.csch"; - - internal const string BrimstoneAtriumType3Key = "Brimstone Atrium Type 3 Key"; - internal const string BrimstoneAtriumType3Filename = "Schematics/Brimstone_Atrium3.csch"; - - internal const string BonescrapperCacheType1Key = "Bonescrapper Cache Type 1 Key"; - internal const string BonescrapperCacheType1Filename = "Schematics/Bonescrapper_Cache1.csch"; - - internal const string BonescrapperCacheType2Key = "Bonescrapper Cache Type 2 Key"; - internal const string BonescrapperCacheType2Filename = "Schematics/Bonescrapper_Cache2.csch"; - - internal const string BonescrapperCacheType3Key = "Bonescrapper Cache Type 3 Key"; - internal const string BonescrapperCacheType3Filename = "Schematics/Bonescrapper_Cache3.csch"; - - internal const string BonescrapperCacheType4Key = "Bonescrapper Cache Type 4 Key"; - internal const string BonescrapperCacheType4Filename = "Schematics/Bonescrapper_Cache4.csch"; - - internal const string BonescrapperCacheType5Key = "Bonescrapper Cache Type 5 Key"; - internal const string BonescrapperCacheType5Filename = "Schematics/Bonescrapper_Cache5.csch"; - - internal const string BonescrapperCacheType6Key = "Bonescrapper Cache Type 6 Key"; - internal const string BonescrapperCacheType6Filename = "Schematics/Bonescrapper_Cache6.csch"; - - internal const string SanctumofOblivionType1Key = "Sanctum of Oblivion Type 1 Key"; - internal const string SanctumofOblivionType1Filename = "Schematics/Sanctum_of_Oblivion1.csch"; - - internal const string SanctumofOblivionType2Key = "Sanctum of Oblivion Type 2 Key"; - internal const string SanctumofOblivionType2Filename = "Schematics/Sanctum_of_Oblivion2.csch"; - - internal const string SanctumofOblivionType3Key = "Sanctum of Oblivion Type 3 Key"; - internal const string SanctumofOblivionType3Filename = "Schematics/Sanctum_of_Oblivion3.csch"; - - internal const string HellstoneStrongholdType1Key = "Hellstone Stronghold Type 1 Key"; - internal const string HellstoneStrongholdType1Filename = "Schematics/Hellstone_Stronghold1.csch"; - - internal const string HellstoneStrongholdType2Key = "Hellstone Stronghold Type 2 Key"; - internal const string HellstoneStrongholdType2Filename = "Schematics/Hellstone_Stronghold2.csch"; - - internal const string DemonicDungeonType1Key = "Demonic Dungeon Type 1 Key"; - internal const string DemonicDungeonType1Filename = "Schematics/Demonic_Dungeon1.csch"; - - internal const string DemonicDungeonType2Key = "Demonic Dungeon Type 2 Key"; - internal const string DemonicDungeonType2Filename = "Schematics/Demonic_Dungeon2.csch"; - - internal const string BarbedStockadeType1Key = "Barbed Stockade Type 1 Key"; - internal const string BarbedStockadeType1Filename = "Schematics/Barbed_Stockade1.csch"; - - internal const string BarbedStockadeType2Key = "Barbed Stockade Type 2 Key"; - internal const string BarbedStockadeType2Filename = "Schematics/Barbed_Stockade2.csch"; - - internal const string BarbedStockadeType3Key = "Barbed Stockade Type 3 Key"; - internal const string BarbedStockadeType3Filename = "Schematics/Barbed_Stockade3.csch"; - - internal const string BarbedStockadeType4Key = "Barbed Stockade Type 4 Key"; - internal const string BarbedStockadeType4Filename = "Schematics/Barbed_Stockade4.csch"; - internal const string RustedWorkshopKey = "Rusted Workshop"; internal const string RustedWorkshopFilename = "Schematics/RustedWorkshop.csch"; @@ -172,28 +112,6 @@ namespace CalamityMod.Schematics // Shimmer Shrine [ShimmerShrineKey] = CalamitySchematicIO.LoadSchematic(ShimmerShrineFilename), - // Underworld structures - [BrimstoneAtriumType1Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType1Filename), - [BrimstoneAtriumType2Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType2Filename), - [BrimstoneAtriumType3Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType3Filename), - [BonescrapperCacheType1Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType1Filename), - [BonescrapperCacheType2Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType2Filename), - [BonescrapperCacheType3Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType3Filename), - [BonescrapperCacheType4Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType4Filename), - [BonescrapperCacheType5Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType5Filename), - [BonescrapperCacheType6Key] = CalamitySchematicIO.LoadSchematic(BonescrapperCacheType6Filename), - [SanctumofOblivionType1Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType1Filename), - [SanctumofOblivionType2Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType2Filename), - [SanctumofOblivionType3Key] = CalamitySchematicIO.LoadSchematic(SanctumofOblivionType3Filename), - [HellstoneStrongholdType1Key] = CalamitySchematicIO.LoadSchematic(HellstoneStrongholdType1Filename), - [HellstoneStrongholdType2Key] = CalamitySchematicIO.LoadSchematic(HellstoneStrongholdType2Filename), - [DemonicDungeonType1Key] = CalamitySchematicIO.LoadSchematic(DemonicDungeonType1Filename), - [DemonicDungeonType2Key] = CalamitySchematicIO.LoadSchematic(DemonicDungeonType2Filename), - [BarbedStockadeType1Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType1Filename), - [BarbedStockadeType2Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType2Filename), - [BarbedStockadeType3Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType3Filename), - [BarbedStockadeType4Key] = CalamitySchematicIO.LoadSchematic(BarbedStockadeType4Filename), - // Draedon's Arsenal world gen structures [RustedWorkshopKey] = CalamitySchematicIO.LoadSchematic(RustedWorkshopFilename), [ResearchOutpostKey] = CalamitySchematicIO.LoadSchematic(ResearchOutpostFilename), diff --git a/Sounds/Custom/BubbleCracklePop.ogg b/Sounds/Custom/BubbleCracklePop.ogg deleted file mode 100644 index f1f0f2deca..0000000000 Binary files a/Sounds/Custom/BubbleCracklePop.ogg and /dev/null differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinFail1.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinFail1.ogg new file mode 100644 index 0000000000..5f3d4ce420 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinFail1.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinFail2.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinFail2.ogg new file mode 100644 index 0000000000..5af604670c Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinFail2.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinFail3.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinFail3.ogg new file mode 100644 index 0000000000..5080c3b101 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinFail3.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinPass1.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinPass1.ogg new file mode 100644 index 0000000000..2e7fb5a471 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinPass1.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineCoinPass2.ogg b/Sounds/Custom/DivineSwine/DivineSwineCoinPass2.ogg new file mode 100644 index 0000000000..a195c3cc36 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineCoinPass2.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle1.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle1.ogg new file mode 100644 index 0000000000..6c0ad78480 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle1.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle2.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle2.ogg new file mode 100644 index 0000000000..13b5108c9e Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle2.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle3.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle3.ogg new file mode 100644 index 0000000000..d8ed0521be Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle3.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineIdle4.ogg b/Sounds/Custom/DivineSwine/DivineSwineIdle4.ogg new file mode 100644 index 0000000000..1425ea5cc8 Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineIdle4.ogg differ diff --git a/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop.ogg b/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop.ogg new file mode 100644 index 0000000000..3f139a4bac Binary files /dev/null and b/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop.ogg differ diff --git a/Sounds/Custom/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/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/StooldownResolve.ogg b/Sounds/Item/StooldownResolve.ogg new file mode 100644 index 0000000000..0c32496879 Binary files /dev/null and b/Sounds/Item/StooldownResolve.ogg differ diff --git a/Sounds/Item/TitaniumRailgunShoot.ogg b/Sounds/Item/TitaniumRailgunShoot.ogg new file mode 100644 index 0000000000..c1d9486835 Binary files /dev/null and b/Sounds/Item/TitaniumRailgunShoot.ogg differ diff --git a/Sounds/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 c2ecc10552..d2b5741368 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using CalamityMod.Buffs; +using CalamityMod.Buffs; using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; @@ -8,6 +7,9 @@ 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 +20,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(), 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,53 +48,142 @@ 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(), 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(), 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 + 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 }; + 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, + + 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.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 } - }; + 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..4b6187dbfd 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -1,22 +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; @@ -28,71 +25,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 +102,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 +114,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 +128,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()); } } diff --git a/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index 43746c5ce6..a59adcbdd0 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -48,64 +48,78 @@ 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, 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.AngryNimbus, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, NPCID.DesertDjinn, NPCID.DiabolistRed, NPCID.DiabolistWhite, + 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.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.AncientDoom); @@ -114,20 +128,22 @@ namespace CalamityMod.Systems.Collections /// 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); /// @@ -136,52 +152,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(), @@ -197,13 +220,111 @@ namespace CalamityMod.Systems.Collections /// /// If for an NPC type, or will be called on this NPC even if is set. /// - 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()); + + /// + /// The intended kill times of Calamity bosses, in frames + /// + public static int[] BossKillTimes = Factory.CreateNamedSet("BossKillTimes") + .Description("The intended kill times of Calamity bosses, 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 4ced4a300a..e16dc062b4 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.
/// 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.
/// 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,28 +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("Disables a projectile from increasing Daawnlight Spirit Origin's extra crit") + .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/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 27f2b46595..7ccf1fff33 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -1238,6 +1238,13 @@ namespace CalamityMod.Systems r.SortAfterFirstRecipesOf(ItemID.CookedFish); r.DisableDecraft(); + r = Recipe.Create(ItemID.CookedFish); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.SortAfterFirstRecipesOf(ItemID.CookedFish); + r.DisableDecraft(); + r = Recipe.Create(ItemID.CookedFish); r.AddIngredient(); r.AddTile(TileID.CookingPots); @@ -1275,13 +1282,6 @@ namespace CalamityMod.Systems #endregion #region Seafood Dinner - r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(); // Consistency would be 2, but considering you need only 1 for Golden Delight, I'm leaving this at 1 - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); - r.DisableDecraft(); - r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); @@ -1318,50 +1318,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(); @@ -1390,6 +1346,18 @@ namespace CalamityMod.Systems r.AddTile(TileID.CookingPots); r.Register(); r.DisableDecraft(); + + r = Recipe.Create(ItemID.Bacon); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.DisableDecraft(); + + r = Recipe.Create(ItemID.GoldenDelight); + r.AddIngredient(); + r.AddTile(TileID.CookingPots); + r.Register(); + r.DisableDecraft(); } #endregion diff --git a/Systems/Mechanic/TrustyOldRodEnemySystem.cs b/Systems/Mechanic/TrustyOldRodEnemySystem.cs index 63b2c5b925..dacc8fdc69 100644 --- a/Systems/Mechanic/TrustyOldRodEnemySystem.cs +++ b/Systems/Mechanic/TrustyOldRodEnemySystem.cs @@ -18,7 +18,6 @@ using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.Other; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.PlagueEnemies; @@ -45,7 +44,7 @@ namespace CalamityMod.Systems // Some spawns change with progression public static void SpawnTrustyOldRodNPC(Player owner, int bobberWhoAmI, int rarity = 1, bool Lava = false, bool Honey = false) { - Projectile bobber = Main.projectile[bobberWhoAmI]; + Projectile bobber = Main.projectile.FirstOrDefault(p => p.identity == bobberWhoAmI); bool common = rarity == 1; bool rare = rarity == 2; bool ultraRare = rarity == 3; @@ -662,6 +661,16 @@ namespace CalamityMod.Systems } } + #endregion + } + + public static void DoTrustyOldRodVFX(Player owner, int bobberWhoAmI, int rarity = 1, bool Lava = false, bool Honey = false) + { + Projectile bobber = Main.projectile.FirstOrDefault(p => p.identity == bobberWhoAmI); + bool common = rarity == 1; + bool rare = rarity == 2; + bool ultraRare = rarity == 3; + float scale = (common ? 1 : rare ? 2.5f : 6); for (int i = 0; i < (int)(12 * scale); i++) { @@ -686,7 +695,6 @@ namespace CalamityMod.Systems SoundStyle epicFail = new("CalamityMod/Sounds/Item/WaterSplash", 2); SoundEngine.PlaySound(epicFail with { Volume = 0.4f + 0.1f * scale, Pitch = 0.2f - 0.1f * scale }, bobber.Center); bobber.velocity += -Vector2.UnitY * (common ? 10 : rare ? 20 : 45); - #endregion } } } diff --git a/Systems/ProgressionAndEvent/DownedBossSystem.cs b/Systems/ProgressionAndEvent/DownedBossSystem.cs index 656e5d0534..c7aa1f0091 100644 --- a/Systems/ProgressionAndEvent/DownedBossSystem.cs +++ b/Systems/ProgressionAndEvent/DownedBossSystem.cs @@ -45,6 +45,7 @@ namespace CalamityMod // Minibosses internal static bool _downedGSS = false; + internal static bool _downedHorribleHog = false; internal static bool _downedCLAM = false; internal static bool _downedCLAMHardMode = false; internal static bool _downedCragmawMire = false; @@ -381,6 +382,17 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedPrimordialWyrm, -1); } } + public static bool downedHorribleHog + { + get => _downedHorribleHog; + set + { + if (!value) + _downedHorribleHog = false; + else + NPC.SetEventFlagCleared(ref _downedHorribleHog, -1); + } + } public static bool downedCLAM { get => _downedCLAM; @@ -548,6 +560,7 @@ namespace CalamityMod downedSecondSentinels = false; + downedHorribleHog = false; downedCLAM = false; downedEoCAcidRain = false; @@ -644,6 +657,8 @@ namespace CalamityMod downed.Add("adultEidolonWyrm"); // Minibosses and events + if (downedHorribleHog) + downed.Add("horribleHog"); if (downedCLAM) downed.Add("clam"); if (downedEoCAcidRain) @@ -711,6 +726,7 @@ namespace CalamityMod downedCalamitas = downed.Contains("supremeCalamitas"); downedPrimordialWyrm = downed.Contains("adultEidolonWyrm"); + downedHorribleHog = downed.Contains("horribleHog"); downedCLAM = downed.Contains("clam"); downedEoCAcidRain = downed.Contains("eocRain"); diff --git a/Systems/World/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs index 4bf79cb76b..e0b0d26647 100644 --- a/Systems/World/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -301,6 +301,7 @@ namespace CalamityMod flags12[3] = downedBossRush; flags12[4] = DraedonMechdusa; flags12[5] = unlockedTownPig; + flags12[5] = downedHorribleHog; writer.Write(flags); writer.Write(flags2); @@ -456,6 +457,7 @@ namespace CalamityMod downedBossRush = flags12[3]; DraedonMechdusa = flags12[4]; unlockedTownPig = flags12[5]; + downedHorribleHog = flags12[5]; RecipeUnlockHandler.ReceiveData(reader); diff --git a/Systems/World/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs index 81feca5779..af39e18446 100644 --- a/Systems/World/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Systems continue; CalamityGlobalNPC.AttemptToSpawnLabCritters(p); - CalamityGlobalNPC.AttemptToSpawnLavaNPCs(p); + //CalamityGlobalNPC.AttemptToSpawnLavaNPCs(p); } // Spawn the Old Man if Skeletron hasn't been defeated and there is no Old Man, it takes too fucking long otherwise. diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 0ccd7c76dc..7cd974f5e0 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -53,33 +53,10 @@ namespace CalamityMod.Systems #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref double totalWeight) { - // Better Underworld (similar to Don't Dig Up seed but with some adjustments) - int underworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); - if (underworldIndex != -1) - { - tasks[underworldIndex] = new PassLegacy("Underworld", (progress, config) => - { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; - CustomUnderworld.NewUnderworld(); - }); - } - // Better Underworld structures after the world has been smoothed int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); if (underworldStructuresIndex != -1) { - tasks.Insert(underworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => - { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; - CustomUnderworld.NewUnderworldStructures(); - - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; - CustomUnderworld.AshTreesAndGrass(); - - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; - CustomUnderworld.PlaceGeyserTraps(); - })); - // Generate the Shimmer Shrine directly above the center of the underground Shimmer lake tasks.Insert(underworldStructuresIndex + 2, new PassLegacy("Shimmer Shrine", (progress, config) => { @@ -228,38 +205,16 @@ namespace CalamityMod.Systems })); } - // Sunken Sea - int sunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); - if (sunkenSeaIndex != -1) + // Sunken sea + int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again")); + if (SunkenSeaIndex != -1) { - tasks.Insert(sunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => + tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { - int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; - int sunkenSeaY = Main.maxTilesY / 2; - - // place each piece of the sunken sea based on the above positons - - // messages intentionally in the "incorrect" order for the player's experience. - // they'll see the OG message first, then subsequent biomes are placed in vertical order. - // it breaks up the 3 minute gen time and makes it more interesting for those who dont tab out while worldgen runs, - // rather than keeping the player in the dark about what's happening. - // it doesn't have to make sense, just be cool for the players :) -ena - //SunkenSea.PlaceBasaltGullyBorderBlend(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; - SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.TimelessShores").Value; - SunkenSea.PlaceRadiantReefs(sunkenSeaX, sunkenSeaY + 110); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.RadiantReefs").Value; - SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.PolypForest").Value; - SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); - SunkenSea.PlaceGleamingBurrowsGeodes(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; - SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; - //SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - SunkenSea.PlaceSunkenSeaAmbience(); + + Point ssBottomLeft = new Point(GenVars.UndergroundDesertLocation.Left, Main.maxTilesY - 400); + SunkenSea.Place(ssBottomLeft); })); } @@ -418,6 +373,12 @@ namespace CalamityMod.Systems SulphurousSea.SulphurSeaGenerationAfterAbyss(); })); + tasks.Insert(++currentFinalIndex, new PassLegacy("Iron Ball", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.IronBall").Value; + MiscWorldgenRoutines.GenerateIronBall(); + })); + // No Traps/GFB Auric Land Mines if (Main.noTrapsWorld) { diff --git a/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/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.png b/Tiles/Furniture/CorruptionEffigy.png index 4389f81731..665d755fd0 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..bd91211397 100644 Binary files a/Tiles/Furniture/CorruptionEffigy_Highlight.png and b/Tiles/Furniture/CorruptionEffigy_Highlight.png differ diff --git a/Tiles/Furniture/ForgottenNobleStatueTile.cs b/Tiles/Furniture/ForgottenNobleStatueTile.cs deleted file mode 100644 index 31822fe198..0000000000 --- a/Tiles/Furniture/ForgottenNobleStatueTile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Tiles.Furniture -{ - public class ForgottenNobleStatueTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 7; - TileObjectData.newTile.Origin = new Point16(2, 7); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 20 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} diff --git a/Tiles/Furniture/ForgottenNobleStatueTile.png b/Tiles/Furniture/ForgottenNobleStatueTile.png deleted file mode 100644 index 1a7786c565..0000000000 Binary files a/Tiles/Furniture/ForgottenNobleStatueTile.png and /dev/null differ diff --git a/Tiles/Furniture/ForgottenScholarStatueTile.cs b/Tiles/Furniture/ForgottenScholarStatueTile.cs deleted file mode 100644 index 4aa9e5556a..0000000000 --- a/Tiles/Furniture/ForgottenScholarStatueTile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria; -using Terraria.ModLoader; -using Terraria.ObjectData; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Tiles.Furniture -{ - public class ForgottenScholarStatueTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 6; - TileObjectData.newTile.Origin = new Point16(2, 6); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 20 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - } -} diff --git a/Tiles/Furniture/ForgottenScholarStatueTile.png b/Tiles/Furniture/ForgottenScholarStatueTile.png deleted file mode 100644 index 21859be3fb..0000000000 Binary files a/Tiles/Furniture/ForgottenScholarStatueTile.png and /dev/null differ diff --git a/Tiles/Furniture/GluttonyBlender.cs b/Tiles/Furniture/GluttonyBlender.cs index f52991cc15..514b8238d5 100644 --- a/Tiles/Furniture/GluttonyBlender.cs +++ b/Tiles/Furniture/GluttonyBlender.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Tiles.Furniture public override void MouseOver(int i, int j) { Player p = Main.LocalPlayer; - // You shouldn't be able to put the slop back into the blender - if (BuffID.Sets.IsWellFed[p.HeldItem.buffType] && p.HeldItem.type != ModContent.ItemType()) + // 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; @@ -134,12 +134,12 @@ namespace CalamityMod.Tiles.Furniture { // 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 (you cannot feed the slop back into the blender) + // * 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.type == ModContent.ItemType()) + if (!BuffID.Sets.IsWellFed[item.buffType] || !item.consumable || (item.buffType == BuffID.WellFed3 && item.buffTime >= CalamityUtils.MinutesToFrames(30))) return true; Point mouseTile = Main.MouseWorld.ToTileCoordinates(); @@ -156,6 +156,8 @@ namespace CalamityMod.Tiles.Furniture if (ItemLoader.ConsumeItem(item, player)) { item.stack--; + if (player.selectedItem == 58) + Main.mouseItem.stack--; if (item.stack <= 0) item.TurnToAir(); } @@ -232,7 +234,12 @@ namespace CalamityMod.Tiles.Furniture if (Projectile.timeLeft == 1 && Main.netMode != NetmodeID.MultiplayerClient) { - int itemDrop = Main.rand.NextBool(GluttonyBlender.OneInXChanceForGoodSlop) ? ModContent.ItemType() : ModContent.ItemType(); + Item dummy = new Item(); + dummy.SetDefaults(ItemType); + // 0.5% per minute of duration, multiplied by 1.5x for T@ food and 2x for T3 food + float goodPercent = dummy.buffTime * (dummy.buffType == BuffID.WellFed3 ? 2f : dummy.buffType == BuffID.WellFed2 ? 1.5f : 1f) / 3600f / 2f; + + int itemDrop = Main.rand.NextFloat(100f) < goodPercent ? ModContent.ItemType() : ModContent.ItemType(); int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, itemDrop); Main.item[i].GetGlobalItem().FromGluttonyBlender = true; } diff --git a/Tiles/Furniture/OtonilouStatueTile.cs b/Tiles/Furniture/OtonilouStatueTile.cs deleted file mode 100644 index 2505c01af3..0000000000 --- a/Tiles/Furniture/OtonilouStatueTile.cs +++ /dev/null @@ -1,46 +0,0 @@ -using CalamityMod.Items.Placeables.Furniture; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ObjectData; -using Terraria; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Tiles.Furniture -{ - public class OtonilouStatueTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Width = 14; - TileObjectData.newTile.Height = 26; - TileObjectData.newTile.Origin = new Point16(2, 24); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20 }; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - - TileObjectData.addTile(Type); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - } -} diff --git a/Tiles/Furniture/OtonilouStatueTile.png b/Tiles/Furniture/OtonilouStatueTile.png deleted file mode 100644 index 856cef13cb..0000000000 Binary files a/Tiles/Furniture/OtonilouStatueTile.png and /dev/null differ diff --git a/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs b/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs deleted file mode 100644 index cd203d22fe..0000000000 --- a/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.Furniture.Paintings -{ - public class AmidiasPaintingTile : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileSpelunker[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); - TileObjectData.newTile.Width = 6; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.addTile(Type); - - TileID.Sets.DisableSmartCursor[Type] = true; - TileID.Sets.FramesOnKillWall[Type] = true; - TileID.Sets.DisableSmartCursor[Type] = true; - DustType = DustID.WoodFurniture; - AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); - } - } -} diff --git a/Tiles/Furniture/Paintings/AmidiasPaintingTile.png b/Tiles/Furniture/Paintings/AmidiasPaintingTile.png deleted file mode 100644 index b2f4c1b913..0000000000 Binary files a/Tiles/Furniture/Paintings/AmidiasPaintingTile.png and /dev/null differ diff --git a/Tiles/Furniture/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/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/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/GreedPotTile.cs b/Tiles/GreedPotTile.cs index 59e4550dea..ea6b14db63 100644 --- a/Tiles/GreedPotTile.cs +++ b/Tiles/GreedPotTile.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Net; -using System.Text; -using System.Threading.Tasks; using CalamityMod.DataStructures; +using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Particles; using CalamityMod.Utilities.Daybreak; @@ -50,12 +48,29 @@ namespace CalamityMod.Tiles player.cursorItemIconID = availableOres[(int)((Main.GlobalTimeWrappedHourly * 2) % availableOres.Count)]; } + public override void NearbyEffects(int i, int j, bool closer) + { + if (TileEntity.TryGet(new(i, j), out var greedPotTE) && greedPotTE.Activated && Main.LocalPlayer.miscCounter % 5 == 0) + { + Tile tile = Main.tile[i, j]; + + int left = i - tile.TileFrameX % (3 * 18) / 18; + if (left != i) + return; + int top = j - tile.TileFrameY % (3 * 18) / 18; + if (top != j) + return; + + Point position = new(left, top); + HeavySmokeParticle p = new(position.ToWorldCoordinates(24 + Main.rand.Next(-10, 11), 2), Vector2.UnitY * -2, Color.Crimson, 90, Main.rand.NextFloat(0.2f, 0.3f), 0.75f, Main.rand.NextFloat(-0.05f, 0.05f), true); + GeneralParticleHandler.SpawnParticle(p); + } + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { if (TileEntity.TryGet(new(i, j), out var greedPotTE)) - { frameXOffset = 18 * 3 * greedPotTE.MyFrame; - } } } @@ -75,10 +90,16 @@ namespace CalamityMod.Tiles { 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; @@ -99,14 +120,14 @@ namespace CalamityMod.Tiles public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); - public override void Update() + public void UpdateOnAllClients() { - if(Activated) + if (Activated) { - if(CurrentFrame != 3) + if (CurrentFrame != 3) { FrameTime++; - if(FrameTime % FrameRate == 0) + if (FrameTime % FrameRate == 0) { FrameTime = 0; CurrentFrame = (byte)((CurrentFrame + 1) % FrameTotal); @@ -120,12 +141,6 @@ namespace CalamityMod.Tiles return; } - if(TimeSinceActivation % 5 == 0) - { - HeavySmokeParticle p = new(Position.ToWorldCoordinates(24 + Main.rand.Next(-10, 11), 2), Vector2.UnitY * -2, Color.Crimson, 90, Main.rand.NextFloat(0.2f, 0.3f), 0.75f, Main.rand.NextFloat(-0.05f, 0.05f), true); - GeneralParticleHandler.SpawnParticle(p); - } - TimeSinceActivation++; } else @@ -158,6 +173,21 @@ namespace CalamityMod.Tiles } } + //Mod Tile Entity's Update functions don't get called on multiplayer clients + public class GreedPotTEUpdateSystem : ModSystem + { + public override void PostUpdateProjectiles() + { + foreach (TileEntity te in TileEntity.ByID.Values) + { + if (te is not GreedPotTE greedTE) + continue; + + greedTE.UpdateOnAllClients(); + } + } + } + public class GreedTransmutation : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Misc"; @@ -210,6 +240,8 @@ namespace CalamityMod.Tiles BezierCurve path = null; private bool Success = false; + private int random = -1; + public override void SetDefaults() { Projectile.width = 24; @@ -230,10 +262,20 @@ namespace CalamityMod.Tiles Projectile.netUpdate = true; } + public override bool PreAI() + { + if (Projectile.timeLeft == 120) + { + GreedPotTE te = TileEntity.ByID[(int)Projectile.ai[2]] as GreedPotTE; + te.Activated = true; + te.TimeSinceActivation = 0; + } + return true; + } public override void AI() { - if(path == null) + if (path == null) { Vector2 startPoint = StartPosition; Vector2 endPoint = PotPosition - Vector2.UnitY * 64; @@ -253,31 +295,36 @@ namespace CalamityMod.Tiles float lerp = 1 - MathHelper.Clamp(((Projectile.timeLeft - 60) / 60f), 0f, 1f); Projectile.Center = path.Evaluate(CalamityUtils.CircOutEasing(lerp, 1)); + } - if (Projectile.timeLeft == 1) + public override void OnKill(int timeLeft) + { + if (Main.myPlayer == Projectile.owner) { int i = Item.NewItem(Projectile.GetItemSource_DropAsItem(), Projectile.Center, Success ? SuccessOutputItemType : ItemID.StoneBlock); - Main.item[i].GetGlobalItem().FromGreedPot = true; + if (i >= 0) + { + Main.item[i].GetGlobalItem().FromGreedPot = true; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i); + } } } public override bool PreDraw(ref Color lightColor) { - //Anim Plan - //Moving to Pos: 0 -> 60 - //Darken: 70 -> 80 - //Transform: 90 -> 100 - //Undarken: 110 -> 120 - int animTime = 120 - Projectile.timeLeft; bool beforeDarken = animTime < 50; bool darken = animTime < 90; bool transform = animTime < 110; - if(beforeDarken) + if (random == -1) + random = Main.rand.Next(120); + + if (beforeDarken) { Texture2D tex = TextureAssets.Item[InputItemType].Value; - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, lightColor, Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, lightColor, Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); } else if (darken) { @@ -290,7 +337,7 @@ namespace CalamityMod.Tiles glowLerp = CalamityUtils.SineInEasing(glowLerp, 1); Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson * glowLerp, Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, glowLerp), 0, 0); + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Crimson * glowLerp, Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, glowLerp), 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(snap); @@ -299,7 +346,7 @@ namespace CalamityMod.Tiles darkenLerp = CalamityUtils.CircInEasing(darkenLerp, 1); Texture2D tex = TextureAssets.Item[InputItemType].Value; - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Lerp(lightColor, Color.Black, darkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Lerp(lightColor, Color.Black, darkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); } else if(transform) { @@ -309,7 +356,7 @@ namespace CalamityMod.Tiles Main.spriteBatch.Begin(newSnap); Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson, Projectile.rotation, glow.Size() * 0.5f, 0.15f, 0, 0); + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Crimson, Projectile.rotation, glow.Size() * 0.5f, 0.15f, 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(snap); @@ -319,8 +366,8 @@ namespace CalamityMod.Tiles float transformLerp = MathHelper.Clamp((animTime - 90) / 10f, 0f, 1f); //transformLerp = CalamityUtils.SineInOutEasing(transformLerp, 1); - Main.spriteBatch.Draw(inputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, 1 - transformLerp, 0, 0); - Main.spriteBatch.Draw(outputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, transformLerp, 0, 0); + Main.spriteBatch.Draw(inputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, 1 - transformLerp, 0, 0); + Main.spriteBatch.Draw(outputTex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Black, Projectile.rotation, inputTex.Size() * 0.5f, transformLerp, 0, 0); } else { @@ -333,16 +380,30 @@ namespace CalamityMod.Tiles Main.spriteBatch.Begin(newSnap); Texture2D glow = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Crimson * (1 - undarkenLerp), Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, (1 - undarkenLerp)), 0, 0); + Main.spriteBatch.Draw(glow, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Crimson * (1 - undarkenLerp), Projectile.rotation, glow.Size() * 0.5f, MathHelper.Lerp(0.05f, 0.15f, (1 - undarkenLerp)), 0, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(snap); Texture2D tex = TextureAssets.Item[Success ? SuccessOutputItemType : ItemID.StoneBlock].Value; - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + Projectile.ai[2]) * 8), null, Color.Lerp(Color.Black, lightColor, undarkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Vector2.UnitY * MathF.Sin(Main.GlobalTimeWrappedHourly + random) * 8), null, Color.Lerp(Color.Black, lightColor, undarkenLerp), Projectile.rotation, tex.Size() * 0.5f, 1f, 0, 0); } return false; } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(StartPosition); + writer.WriteVector2(PotPosition); + writer.Write(Success); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + StartPosition = reader.ReadVector2(); + PotPosition = reader.ReadVector2(); + Success = reader.ReadBoolean(); + } } public class GreedTransmutationGlobalItem : GlobalItem @@ -353,9 +414,6 @@ namespace CalamityMod.Tiles public override bool? UseItem(Item item, Player player) { - if (Main.LocalPlayer.whoAmI != player.whoAmI) - return null; - if (!GreedTransmutation.GreedChain.TryGetValue(item.type, out var transmutation)) return null; @@ -371,17 +429,28 @@ namespace CalamityMod.Tiles if (!player.IsInTileInteractionRange(mouseTile.X, mouseTile.Y, TileReachCheckSettings.Simple)) return null; - Projectile.NewProjectile(Projectile.GetSource_NaturalSpawn(), Main.LocalPlayer.Center, greedPotTE.Position.ToWorldCoordinates(24, 24) + Main.rand.NextVector2Circular(12, 32), ModContent.ProjectileType(), 0, 0, Main.LocalPlayer.whoAmI, item.type, transmutation.Result, Main.rand.Next(120)); + if (Main.myPlayer == player.whoAmI) + Projectile.NewProjectile(Projectile.GetSource_NaturalSpawn(), player.Center, greedPotTE.Position.ToWorldCoordinates(24, 24) + Main.rand.NextVector2Circular(12, 32), ModContent.ProjectileType(), 0, 0, player.whoAmI, item.type, transmutation.Result, greedPotTE.ID); + greedPotTE.Activated = true; greedPotTE.TimeSinceActivation = 0; player.ApplyItemTime(item, 0.5f, false); - return false; } public override bool CanStackInWorld(Item destination, Item source) { - return !destination.GetGlobalItem().FromGreedPot || !source.GetGlobalItem().FromGreedPot; + return !destination.GetGlobalItem().FromGreedPot && !source.GetGlobalItem().FromGreedPot; + } + + public override void NetSend(Item item, BinaryWriter writer) + { + writer.Write(FromGreedPot); + } + + public override void NetReceive(Item item, BinaryReader reader) + { + FromGreedPot = reader.ReadBoolean(); } } } diff --git a/Tiles/IronBallPlaced.cs b/Tiles/IronBallPlaced.cs new file mode 100644 index 0000000000..7b3a7dc65d --- /dev/null +++ b/Tiles/IronBallPlaced.cs @@ -0,0 +1,55 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class IronBallPlaced : ModTile + { + public static Asset GlowTexture = null; + + public override void Load() + { + GlowTexture = ModContent.Request("CalamityMod/Tiles/IronBallPlaced_Glow"); + } + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLighted[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileOreFinderPriority[Type] = 770; // Same as Chillet + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + DustType = DustID.Silver; + + AddMapEntry(new Color(108, 118, 134), CalamityUtils.GetText("Tiles.IronBall")); + RegisterItemDrop(ModContent.ItemType()); + FlexibleTileWand.RubblePlacementSmall.AddVariations(ModContent.ItemType(), Type, 0); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + // Dim flickering red light + r = MathF.Sin(Main.GlobalTimeWrappedHourly * 20) * 0.05f + 0.3f; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + spriteBatch.Draw(GlowTexture.Value, new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + CalamityUtils.TileDrawOffset, new Rectangle(Main.tile[i, j].TileFrameX, Main.tile[i, j].TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/IronBallPlaced.png b/Tiles/IronBallPlaced.png new file mode 100644 index 0000000000..232ca8d88f Binary files /dev/null and b/Tiles/IronBallPlaced.png differ diff --git a/Tiles/IronBallPlaced_Glow.png b/Tiles/IronBallPlaced_Glow.png new file mode 100644 index 0000000000..ae2214656d Binary files /dev/null and b/Tiles/IronBallPlaced_Glow.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 12cd3e56cb..a7522beb4f 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -5,6 +5,7 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Deconstructors; using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.NormalNPCs.HorribleHog; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; @@ -385,13 +386,13 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 104: - npc = NPCType(); + npc = NPCType(); break; case 105: npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; /*case 107: npc = NPCType(); - Formerly Giant Clam @@ -459,75 +460,79 @@ namespace CalamityMod.Tiles case 128: npc = NPCType(); break; - case 129: + // Hello source code diver, here are a bunch of Sunken Sea enemy names, have fun + /*case 129: npc = NPCType(); - break; - case 130: - npc = NPCType(); - break; - case 131: - npc = NPCType(); - break; - case 132: - npc = NPCType(); - break; - /* case 133: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. break; */ - case 134: + /* case 130: + npc = NPCType(); + break; */ + /* case 131: + npc = NPCType(); + break; */ + /* case 132: + npc = NPCType(); + break; */ + /* case 133: + npc = NPCType(); + break; */ + /* case 134: npc = NPCType(); - break; - case 135: + break; */ + /* case 135: npc = NPCType(); - break; - case 136: + break; */ + /* case 136: npc = NPCType(); - break; - case 137: + break; */ + /* case 137: npc = NPCType(); - break; - case 138: + break; */ + /* case 138: npc = NPCType(); - break; + break; */ /* case 139: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + npc = NPCType(); break; */ /* case 140: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + npc = NPCType(); break; */ - case 141: + /* case 141: npc = NPCType(); // Logic should be applying to other variants - break; - case 142: - npc = NPCType(); - break; - case 143: - npc = NPCType(); - break; - case 144: - npc = NPCType(); - break; - case 145: - npc = NPCType(); - break; - case 146: - npc = NPCType(); - break; - case 147: - npc = NPCType(); - break; - case 148: - npc = NPCType(); - break; - case 149: - npc = NPCType(); - break; - case 150: - npc = NPCType(); - break; - /* case 151: - npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. break; */ + /* case 142: + npc = NPCType(); + break; */ + /* case 143: + npc = NPCType(); + break; */ + /* case 144: + npc = NPCType(); + break; */ + /* case 145: + npc = NPCType(); + break; */ + /* case 146: + npc = NPCType(); + break; */ + /* case 147: + npc = NPCType(); + break; */ + /* case 148: + npc = NPCType(); + break; */ + /* case 149: + npc = NPCType(); + break; */ + /* case 150: + npc = NPCType(); + break; */ + /* case 151: + npc = NPCType(); + break; */ + case 152: + npc = NPCType(); + break; default: break; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 4142434796..218f14301a 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 a4b10b3957..359ab48c4e 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -33,8 +33,6 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.Suffocate[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; - TileID.Sets.Falling[Type] = true; - TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 5); this.RegisterBlendMergeWith(ModContent.TileType()); this.RegisterBlendMergeWith(ModContent.TileType()); diff --git a/UI/FishStocks/FishStocksUI.cs b/UI/FishStocks/FishStocksUI.cs index 65e0bd87d2..0bad391d92 100644 --- a/UI/FishStocks/FishStocksUI.cs +++ b/UI/FishStocks/FishStocksUI.cs @@ -90,7 +90,7 @@ namespace CalamityMod.UI 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 - (1000 * fishStocksSlideValue), overlayBorderTex.Height() * 0.566f + 54 * MathF.Ceiling(player.CountBuffs() / 11f))); + 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; @@ -123,7 +123,7 @@ namespace CalamityMod.UI spriteBatch.End(); using (PixelationLease.Scope(clearColor: Color.Transparent)) { - Matrix pixelationMatrix = Main.UIScaleMatrix * Matrix.CreateScale(0.5f, 0.5f, 1f); + Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f); spriteBatch.Begin(SpriteSortMode.Deferred, default, SamplerState.PointClamp, default, default, default, pixelationMatrix); int lines = 5; @@ -150,10 +150,10 @@ namespace CalamityMod.UI 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) * baseScale; + 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 * baseScale); + 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) 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/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 e18faa6de9..487ee4a02a 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -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/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/World/CustomUnderworld.cs b/World/CustomUnderworld.cs deleted file mode 100644 index 182cc05cd1..0000000000 --- a/World/CustomUnderworld.cs +++ /dev/null @@ -1,2037 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Schematics; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent.Generation; -using Terraria.ID; -using Terraria.WorldBuilding; -using static CalamityMod.Schematics.SchematicManager; - -namespace CalamityMod.World -{ - public class CustomUnderworld - { - // Ash island variables - private const double AshIslandGenStart = 0.36; - private const double AshIslandGenStart_Remix = 0.38; - private const double AshIslandGenEnd = 0.64; - private const double AshIslandGenEnd_Remix = 0.62; - private const int AshIslandDepthMaxAboveTheUnderworldFloor = 135; - private const int AshIslandHeightMaxAboveTheUnderworldFloor = 160; - private const int MaxIslands = 8; - private const int SmallWorldIslands = 4; - private const int MediumWorldIslands = 6; - private const int LargeWorldIslands = MaxIslands; - private const int SmallWorldOuterIslands = 1; - private const int MediumAndLargeWorldOuterIslands = 2; - - // Wall variables - private const int MaxWallHeight = 68; - private const int RandomizedWallSectionHeight = 4; - private const int MaxWallDepthAboveUnderworldFloor = 40; - - public static void NewUnderworld() - { - // Generate lower Underworld ash - int ashMin = 160; - int ashMax = 190; - int ashDepth = Main.maxTilesY - WorldGen.genRand.Next(ashMin, ashMax); - for (int x = 0; x < Main.maxTilesX; x++) - { - ashDepth += WorldGen.genRand.Next(-3, 4); - if (ashDepth < Main.maxTilesY - ashMax) - ashDepth = Main.maxTilesY - ashMax; - - if (ashDepth > Main.maxTilesY - ashMin) - ashDepth = Main.maxTilesY - ashMin; - - for (int y = ashDepth - 20 - WorldGen.genRand.Next(3); y < Main.maxTilesY; y++) - { - if (y >= ashDepth) - { - Main.tile[x, y].Get().HasTile = false; - Main.tile[x, y].Get().LiquidType = LiquidID.Water; - } - else - Main.tile[x, y].TileType = TileID.Ash; - } - } - - // Generate lava - int lavaMin = 80; - int lavaMax = 90; - int lavaDepth = Main.maxTilesY - WorldGen.genRand.Next(lavaMin, lavaMax + 1); - int lavaMaxDepth = Main.maxTilesY - lavaMin; - int lavaMaxHeight = Main.maxTilesY - lavaMax; - for (int x = 10; x < Main.maxTilesX - 10; x++) - { - lavaDepth += WorldGen.genRand.Next(-5, 6); - if (lavaDepth > lavaMaxDepth) - lavaDepth = lavaMaxDepth; - - if (lavaDepth < lavaMaxHeight) - lavaDepth = lavaMaxHeight; - - for (int y = lavaDepth; y < Main.maxTilesY - 10; y++) - { - if (!Main.tile[x, y].HasTile) - { - Main.tile[x, y].Get().LiquidType = LiquidID.Lava; - Main.tile[x, y].LiquidAmount = byte.MaxValue; - } - } - } - - // Ash splotches - for (int x = 0; x < Main.maxTilesX; x++) - { - if (WorldGen.genRand.NextBool(50)) - { - int y = Main.maxTilesY - 65; - while (!Main.tile[x, y].HasTile && y > Main.maxTilesY - 135) - y--; - - WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), y + WorldGen.genRand.Next(20, 50), WorldGen.genRand.Next(15, 20), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); - } - } - - // Some cursed water function - Liquid.QuickWater(-2); - - // More Ash splotches - for (int x = 0; x < Main.maxTilesX; x++) - { - if (WorldGen.genRand.NextBool(13)) - { - int y = Main.maxTilesY - 65; - while ((Main.tile[x, y].LiquidAmount > 0 || Main.tile[x, y].HasTile) && y > Main.maxTilesY - 140) - y--; - - if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) - WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 30), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); - - double ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); - if (WorldGen.genRand.NextBool(3)) - ashSplotchSizeAdjustment *= 0.5; - - if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) - { - if (WorldGen.genRand.NextBool(2)) - WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, 1D, 0.3); - - if (WorldGen.genRand.NextBool(2)) - { - ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); - WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, -1D, 0.3); - } - } - - WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(5, 10), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); - if (WorldGen.genRand.NextBool(3)) - WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(10, 30), WorldGen.genRand.Next(10, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); - - if (WorldGen.genRand.NextBool(5)) - WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 10), WorldGen.genRand.Next(15, 30), WorldGen.genRand.Next(5, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); - } - } - - // Cursed lava placement tile runner, thanks redigit - for (int i = 0; i < Main.maxTilesX; i++) - WorldGen.TileRunner(WorldGen.genRand.Next(20, Main.maxTilesX - 20), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(2, 7), -2); - - // Another cursed lava placement tile runner...seriously, why the fuck is this? - for (int i = 0; i < Main.maxTilesX * 2; i++) - WorldGen.TileRunner(WorldGen.genRand.Next((int)(Main.maxTilesX * 0.35), (int)(Main.maxTilesX * 0.65)), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(5, 20), WorldGen.genRand.Next(5, 10), -2); - - // Place two lines of lava at maxTilesY - 145 and maxTilesY - 144 - if (Main.zenithWorld) - { - for (int x = 0; x < Main.maxTilesX; x++) - { - if (!Main.tile[x, Main.maxTilesY - 145].HasTile) - { - Main.tile[x, Main.maxTilesY - 145].LiquidAmount = byte.MaxValue; - Main.tile[x, Main.maxTilesY - 145].Get().LiquidType = LiquidID.Lava; - } - - if (!Main.tile[x, Main.maxTilesY - 144].HasTile) - { - Main.tile[x, Main.maxTilesY - 144].LiquidAmount = byte.MaxValue; - Main.tile[x, Main.maxTilesY - 144].Get().LiquidType = LiquidID.Lava; - } - } - } - - // Place hellstone splotches - for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008); i++) - WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), WorldGen.genRand.Next(Main.maxTilesY - 140, Main.maxTilesY), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(3, 7), TileID.Hellstone); - - // Remix world stuff, the Ash islands in the middle - - // Start generating islands at this point - int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenStart_Remix : AshIslandGenStart)); - - // Stop generating islands at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenEnd_Remix : AshIslandGenEnd)); - - // Ash island gen limits - int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; - int ashIslandHeightLimit = Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor; - - // Multiple islands in non-remix - if (!WorldGen.remixWorldGen) - { - // Large = 8, Medium = 6, Small = 4 - int numIslands = (int)(Main.maxTilesX / 4200f * 4f); - bool smallWorld = numIslands == SmallWorldIslands; - - // Total extra distance between islands for lava lakes - int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); - - // Extra distance per island - // Due to this being done on both sides of each island, it is divided by 2 - int extraDistanceBetweenAshIslands_PerIslandSide = totalExtraDistanceBetweenAshIslands / numIslands / 2; - - // Calculate distance between islands - int distanceBetweenIslands = (ashIslandX2 - ashIslandX) / numIslands; - - // Used for island height randomization - int minHeightForOuterIslands = 8; - int[] randomHeightAdjustmentLimits = new int[MaxIslands] - { - 28, - 24, - 20, - 16, - 12, - 8, - 4, - 0 - }; - - // Used for island edge drop off randomization - // Taller islands have steeper drop offs - // This is also used to decrease the width of the islands - int minDropOffForOuterIslands = 11; - int[] randomDropOffAdjustmentLimits = new int[MaxIslands] - { - 3, - 4, - 5, - 7, - 9, - 11, - 15, - 19 - }; - - // Loop to gen the islands - int chosenIslandSize; - int previouslyChosenIslandSize = -1; - for (int i = 0; i < numIslands; i++) - { - // Do not repeat the same island size twice in a row - do chosenIslandSize = WorldGen.genRand.Next(MaxIslands); - while (previouslyChosenIslandSize == chosenIslandSize); - previouslyChosenIslandSize = chosenIslandSize; - - int randomizedIslandDropOffAdjustment = randomDropOffAdjustmentLimits[chosenIslandSize]; - int randomizedIslandHeightAdjustment = randomHeightAdjustmentLimits[chosenIslandSize]; - - // Islands on the edges are taller in order to have more structures - bool isTallerIsland = smallWorld ? (i == 0 || i == numIslands - SmallWorldOuterIslands) : (i < MediumAndLargeWorldOuterIslands || i >= numIslands - MediumAndLargeWorldOuterIslands); - if (isTallerIsland && randomizedIslandHeightAdjustment > minHeightForOuterIslands) - { - randomizedIslandHeightAdjustment = minHeightForOuterIslands; - randomizedIslandDropOffAdjustment = minDropOffForOuterIslands; - } - - int randomizedAshIslandDepthLimit = ashIslandDepthLimit + randomizedIslandHeightAdjustment; - int randomizedAshIslandHeightLimit = ashIslandHeightLimit + randomizedIslandHeightAdjustment; - - int ashIslandXAdjustment = distanceBetweenIslands * i; - int ashIslandX2Adjustment = distanceBetweenIslands * (numIslands - i - 1); - - // Decrease the width of each island randomly - // Taller islands have a greater reduction in width - int randomWidthReduction_LeftSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); - int randomWidthReduction_RightSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); - int ashIslandTilePlacementX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands_PerIslandSide + randomWidthReduction_LeftSide; - int ashIslandTilePlacementX2 = ashIslandX2 - ashIslandX2Adjustment - extraDistanceBetweenAshIslands_PerIslandSide - randomWidthReduction_RightSide; - int ashIslandGenLimiter = Main.maxTilesY - 1; - bool ashIslandGenLimitHit = false; - Liquid.QuickWater(-2); - for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) - { - // Less random ash island terrain to make unmodified traversal less annoying - if (!ashIslandGenLimitHit) - { - // Steeper ash island edges - ashIslandGenLimiter -= WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); - if (ashIslandGenLimiter < randomizedAshIslandDepthLimit) - ashIslandGenLimitHit = true; - } - else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) - { - // Steeper ash island edges - ashIslandGenLimiter += WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); - if (ashIslandGenLimiter > Main.maxTilesY - 1) - ashIslandGenLimiter = Main.maxTilesY - 1; - } - else - { - if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) - { - // More randomized terrain depending on island type - // Lower islands have smoother terrain - // Islands on the edges have smoother terrain - if (isTallerIsland) - { - if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - } - else - { - switch (chosenIslandSize) - { - default: - case 0: - case 1: - if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - break; - - case 2: - case 3: - if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(9)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; - - case 4: - case 5: - if (WorldGen.genRand.NextBool()) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; - - case 6: - case 7: - if (WorldGen.genRand.NextBool()) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(4)) - ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); - break; - } - } - } - - if (ashIslandGenLimiter < randomizedAshIslandHeightLimit) - ashIslandGenLimiter = randomizedAshIslandHeightLimit; - - if (ashIslandGenLimiter > randomizedAshIslandDepthLimit) - ashIslandGenLimiter = randomizedAshIslandDepthLimit; - } - - for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) - Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; - - for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) - { - Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); - Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; - Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; - } - } - - // This is necessary due to earlier calculations - int startX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands_PerIslandSide + randomWidthReduction_LeftSide; - int endX = ashIslandTilePlacementX2 + extraDistanceBetweenAshIslands_PerIslandSide * 2; - - // Small holes - double holeFrequency = 0.00005 / numIslands; - for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * holeFrequency); j++) - WorldGen.TileRunner(WorldGen.genRand.Next(startX, endX), WorldGen.genRand.Next(randomizedAshIslandHeightLimit + 30, Main.maxTilesY), WorldGen.genRand.Next(4, 7), WorldGen.genRand.Next(4, 7), -2); - - // Place smaller hellstone splotches in the ash island - // I don't want there to be too many here because I don't want to encourage players to destroy the environmental Wall of Flesh arena - double hellstoneFrequency = 0.0002 / numIslands; - for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * hellstoneFrequency); j++) - WorldGen.TileRunner(WorldGen.genRand.Next(startX, endX), WorldGen.genRand.Next(randomizedAshIslandHeightLimit, Main.maxTilesY), WorldGen.genRand.Next(1, 5), WorldGen.genRand.Next(2, 5), TileID.Hellstone); - } - } - else - { - int ashIslandTilePlacementX = ashIslandX; - int ashIslandTilePlacementX2 = ashIslandX2; - int ashIslandGenLimiter = Main.maxTilesY - 1; - bool ashIslandGenLimitHit = false; - Liquid.QuickWater(-2); - for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) - { - // Less random ash island terrain to make unmodified traversal less annoying - if (!ashIslandGenLimitHit) - { - // Steeper ash island edges - ashIslandGenLimiter -= WorldGen.genRand.Next(1, 4); - if (ashIslandGenLimiter < ashIslandDepthLimit) - ashIslandGenLimitHit = true; - } - else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) - { - // Steeper ash island edges - ashIslandGenLimiter += WorldGen.genRand.Next(1, 4); - if (ashIslandGenLimiter > Main.maxTilesY - 1) - ashIslandGenLimiter = Main.maxTilesY - 1; - } - else - { - if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) - { - if (WorldGen.genRand.NextBool(3)) - ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); - else if (WorldGen.genRand.NextBool(6)) - ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); - else if (WorldGen.genRand.NextBool(8)) - ashIslandGenLimiter += WorldGen.genRand.Next(-4, 5); - } - - if (ashIslandGenLimiter < ashIslandHeightLimit) - ashIslandGenLimiter = ashIslandHeightLimit; - - if (ashIslandGenLimiter > ashIslandDepthLimit) - ashIslandGenLimiter = ashIslandDepthLimit; - } - - for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) - Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; - - for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) - { - Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); - Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; - Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; - } - } - } - - // Generate a line of background walls from the approximate underworld lava line and down - int maxWallHeight = MaxWallHeight; - int randomizedWallSectionsHeight = RandomizedWallSectionHeight; - int maxWallTypes = 4; - int newWallTypeStart = maxWallHeight / maxWallTypes; - int maxWallDepth = Main.maxTilesY - MaxWallDepthAboveUnderworldFloor; - int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; - int cinderWallStartDepth = smoulderingStoneWallStartDepth + newWallTypeStart; - int emberWallStartDepth = cinderWallStartDepth + newWallTypeStart; - int magmaWallStartDepth = emberWallStartDepth + newWallTypeStart; - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = smoulderingStoneWallStartDepth; y < maxWallDepth; y++) - { - if (y < smoulderingStoneWallStartDepth + randomizedWallSectionsHeight) - { - switch (smoulderingStoneWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - } - } - else if (y < cinderWallStartDepth) - { - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - } - else if (y < cinderWallStartDepth + randomizedWallSectionsHeight) - { - switch (cinderWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - break; - } - } - else if (y < emberWallStartDepth) - { - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - } - else if (y < emberWallStartDepth + randomizedWallSectionsHeight) - { - switch (emberWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe2; - break; - } - } - else if (y < magmaWallStartDepth) - { - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - } - else if (y < magmaWallStartDepth + randomizedWallSectionsHeight) - { - switch (magmaWallStartDepth + randomizedWallSectionsHeight - y) - { - case 4: - if (WorldGen.genRand.NextBool(5)) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - - case 3: - if (WorldGen.genRand.NextBool(3)) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - - case 2: - if (WorldGen.genRand.NextBool()) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - - case 1: - if (WorldGen.genRand.Next(4) > 0) - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - else - Main.tile[x, y].WallType = WallID.LavaUnsafe1; - break; - } - } - else - Main.tile[x, y].WallType = WallID.LavaUnsafe3; - } - } - - // Generate background walls in underworld tiles from Main.maxTilesY - 200 and down - for (int x = 0; x < Main.maxTilesX; x++) - { - for (int y = Main.maxTilesY - 200; y <= smoulderingStoneWallStartDepth + randomizedWallSectionsHeight; y++) - { - // The placed wall must be surrounded by non-sloped, non-half brick full tiles, otherwise it won't look right - bool surroundedByFullTiles = false; - bool breakLoop = false; - - int indexStartX = x - 1; - if (indexStartX < 0) - indexStartX = 0; - - int indexEndX = x + 1; - if (indexEndX > Main.maxTilesX) - indexEndX = Main.maxTilesX; - - for (int surroundingTileIndexX = indexStartX; surroundingTileIndexX <= indexEndX; surroundingTileIndexX++) - { - if (breakLoop) - break; - - for (int surroundingTileIndexY = y - 1; surroundingTileIndexY <= y + 1; surroundingTileIndexY++) - { - if (Main.tile[surroundingTileIndexX, surroundingTileIndexY].HasTile && - !Main.tile[surroundingTileIndexX, surroundingTileIndexY].IsHalfBlock && - Main.tile[surroundingTileIndexX, surroundingTileIndexY].Slope == SlopeType.Solid) - { - surroundedByFullTiles = true; - } - else - { - surroundedByFullTiles = false; - breakLoop = true; - break; - } - } - } - - if (surroundedByFullTiles) - Main.tile[x, y].WallType = WallID.LavaUnsafe4; - } - } - - // More cursed magic water function - Liquid.QuickWater(-2); - - // Create grass on ash - for (int x = ashIslandX; x < ashIslandX2 + 15; x++) - { - for (int y = Main.maxTilesY - 300; y < ashIslandDepthLimit + 30; y++) - { - Main.tile[x, y].LiquidAmount = 0; - - if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && - (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || - !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || - !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || - !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) - Main.tile[x, y].TileType = TileID.AshGrass; - } - } - - // Obsidian and hellstone towers... - AddHellHouses(); - } - - public static void NewUnderworldStructures() - { - if (!WorldGen.remixWorldGen) - { - // Generate some structures on the ash islands - int ashIslandX = (int)((double)Main.maxTilesX * AshIslandGenStart); - int ashIslandX2 = (int)((double)Main.maxTilesX * AshIslandGenEnd); - bool cragsLocationIsLeft = GenVars.dungeonLocation < Main.maxTilesX / 2; - int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; - int ashIslandHeightLimit = Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor; - - // Keep track of world size to adjust house distances - float houseDistanceMult = Main.maxTilesX / 4200f; - - // Large = 8, Medium = 6, Small = 4 - int numIslands = (int)(Main.maxTilesX / 4200f * 4f); - - // Small and medium worlds get less structures - bool smallWorld = numIslands == SmallWorldIslands; - bool mediumWorld = numIslands == MediumWorldIslands; - bool largeWorld = numIslands == LargeWorldIslands; - - // Total extra distance between islands for lava lakes - int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); - - // Extra distance per island - // The right side looks better with half of this adjustment subtracted - int divisor = cragsLocationIsLeft ? 2 : 4; - int extraDistanceBetweenAshIslands_PerIslandSide = totalExtraDistanceBetweenAshIslands / numIslands / divisor; - - // Calculate distance between islands - int sideAdjustmentMultiplier = cragsLocationIsLeft ? 1 : -1; - int distanceBetweenStructures = (ashIslandX2 - ashIslandX) / numIslands; - int firstIslandWidth = distanceBetweenStructures + (extraDistanceBetweenAshIslands_PerIslandSide * sideAdjustmentMultiplier); - int firstStructureDistanceFromIslandEdge = firstIslandWidth / 2; - int distanceBetweenStructures_AfterFirstIsland = distanceBetweenStructures; - - // Pick an atrium type - // Small worlds get a random single atrium - // Medium and large worlds get a guaranteed shadow chest atrium and another random non-shadow chest atrium - string atriumMapKey; - int atriumType = smallWorld ? WorldGen.genRand.Next(3) : WorldGen.genRand.Next(2); - int numAtriums = smallWorld ? 1 : 2; - if (!smallWorld) - { - switch (atriumType) - { - default: - case 0: - atriumMapKey = BrimstoneAtriumType1Key; - break; - - case 1: - atriumMapKey = BrimstoneAtriumType3Key; - break; - } - } - else - { - switch (atriumType) - { - default: - case 0: - atriumMapKey = BrimstoneAtriumType1Key; - break; - - case 1: - atriumMapKey = BrimstoneAtriumType2Key; - break; - - case 2: - atriumMapKey = BrimstoneAtriumType3Key; - break; - } - } - var atriumSchematic = TileMaps[atriumMapKey]; - - // Pick stockade types - List stockades = new List(); - int numStockades = largeWorld ? 2 : 1; - int stockadeTypes = 4; - do - { - // Chose a random stockade to add to the list - int chosenStockade = WorldGen.genRand.Next(stockadeTypes); - - // Don't choose the same stockade twice - bool alreadyContainsThisStockadeType = stockades.Contains(chosenStockade); - - if (!alreadyContainsThisStockadeType) - stockades.Add(chosenStockade); - } - while (stockades.Count < numStockades); - - string[] stockadesToGenerate = new string[numStockades]; - for (int stockadeIndex = 0; stockadeIndex < numStockades; stockadeIndex++) - { - switch (stockades[stockadeIndex]) - { - default: - case 0: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType1Key; - break; - - case 1: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType2Key; - break; - - case 2: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType3Key; - break; - - case 3: - stockadesToGenerate[stockadeIndex] = BarbedStockadeType4Key; - break; - } - } - - // Offsets for structures - int atriumOffsetY = 8; - - int cacheOffsetY = 45; - - int sanctumOffsetY = 65; - - int strongholdOffsetX = cragsLocationIsLeft ? 40 : 20; - int strongholdOffsetY = 3; - int secondStrongholdOffsetY = 5; - - int dungeonOffsetX = cragsLocationIsLeft ? 30 : 50; - int dungeonOffsetY = 4; - - int stockadeOffsetX = largeWorld ? strongholdOffsetX : 0; - int secondStockadeOffsetX = dungeonOffsetX; - int stockadeOffsetY = stockadesToGenerate[0] == BarbedStockadeType4Key ? -7 : 8; - - // Place structures - if (cragsLocationIsLeft) - { - // - // Place atriums - // - // Atrium location is on the crags side - int atriumGenX = ashIslandX + firstStructureDistanceFromIslandEdge; - int atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - Point atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - SchematicAnchor anchorType = SchematicAnchor.Center; - bool place = true; - if (!smallWorld) - { - PlaceSchematic(BrimstoneAtriumType2Key, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - // Protect the structure - Rectangle atriumProtectionArea = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea, 10); - - // Move index further along to keep structures spread apart - atriumGenX += distanceBetweenStructures_AfterFirstIsland; - - // Reset the Y index - atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - // Placement point for the second atrium - atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - } - - if (atriumMapKey == BrimstoneAtriumType2Key) - PlaceSchematic(atriumMapKey, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - else - PlaceSchematic>(atriumMapKey, atriumPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle atriumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea2, 10); - - // - // Place sanctums, strongholds, dungeons, and stockades - // - // All of these structures are on the demonic side - int sanctumGenX = ashIslandX2 - firstStructureDistanceFromIslandEdge; - int sanctumGenY = ashIslandDepthLimit + sanctumOffsetY; - - int strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - int dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - int stockadeGenX = sanctumGenX - (smallWorld ? distanceBetweenStructures_AfterFirstIsland : distanceBetweenStructures_AfterFirstIsland * 2); - int stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX + stockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - Point sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - Point strongholdPlacementPoint = new Point(sanctumGenX + strongholdOffsetX, strongholdGenY + strongholdOffsetY); - Point dungeonPlacementPoint = new Point(sanctumGenX - dungeonOffsetX, dungeonGenY + dungeonOffsetY); - Point stockadePlacementPoint = new Point(stockadeGenX + stockadeOffsetX, stockadeGenY + stockadeOffsetY); - if (largeWorld) - { - PlaceSchematic>(stockadesToGenerate[0], stockadePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle stockadeProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[stockadesToGenerate[0]], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea, 10); - - // Reset the Y index for stockades - stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX - secondStockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - // Placement point for the second stockade - int secondStockadeOffsetY = stockadesToGenerate[1] == BarbedStockadeType4Key ? -7 : 8; - stockadePlacementPoint = new Point(stockadeGenX - secondStockadeOffsetX, stockadeGenY + secondStockadeOffsetY); - } - if (!smallWorld) - { - PlaceSchematic>(SanctumofOblivionType1Key, sanctumPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle sanctumProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[SanctumofOblivionType1Key], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea, 10); - - PlaceSchematic(HellstoneStrongholdType1Key, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - // Protect the structure - Rectangle strongholdProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[HellstoneStrongholdType1Key], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea, 10); - - PlaceSchematic>(DemonicDungeonType1Key, dungeonPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle dungeonProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[DemonicDungeonType1Key], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea, 10); - - // Move index further along to keep structures spread apart - sanctumGenX -= distanceBetweenStructures_AfterFirstIsland; - - // Reset the Y index for strongholds - strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - // Placement point for the second stronghold - strongholdPlacementPoint = new Point(sanctumGenX + strongholdOffsetX, strongholdGenY + secondStrongholdOffsetY); - - // Reset the Y index for dungeons - dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - // Placement point for the second dungeon - dungeonPlacementPoint = new Point(sanctumGenX - dungeonOffsetX, dungeonGenY + dungeonOffsetY); - - // Placement point for the second sanctum - sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - } - - // Large worlds have two stockades - string secondStockade = largeWorld ? stockadesToGenerate[1] : stockadesToGenerate[0]; - PlaceSchematic>(secondStockade, stockadePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle stockadeProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStockade], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea2, 10); - - // Small worlds only have one sanctum - string secondSanctum = smallWorld ? SanctumofOblivionType1Key : (WorldGen.genRand.NextBool() ? SanctumofOblivionType2Key : SanctumofOblivionType3Key); - PlaceSchematic>(secondSanctum, sanctumPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle sanctumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondSanctum], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea2, 10); - - // Small worlds only have one stronghold - string secondStronghold = smallWorld ? HellstoneStrongholdType1Key : HellstoneStrongholdType2Key; - PlaceSchematic(secondStronghold, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - // Protect the structure - Rectangle strongholdProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStronghold], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea2, 10); - - // Small worlds only have one dungeon - string secondDungeon = smallWorld ? DemonicDungeonType1Key : DemonicDungeonType2Key; - PlaceSchematic>(secondDungeon, dungeonPlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle dungeonProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondDungeon], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea2, 10); - } - else - { - int atriumGenX = ashIslandX2 - firstStructureDistanceFromIslandEdge; - int atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - Point atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - SchematicAnchor anchorType = SchematicAnchor.Center; - bool place = true; - if (!smallWorld) - { - PlaceSchematic(BrimstoneAtriumType2Key, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - Rectangle atriumProtectionArea = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea, 10); - - atriumGenX -= distanceBetweenStructures_AfterFirstIsland; - - atriumGenY = ashIslandHeightLimit; - while (!Main.tile[atriumGenX, atriumGenY].HasTile) - atriumGenY++; - - atriumPlacementPoint = new Point(atriumGenX, atriumGenY + atriumOffsetY); - } - - if (atriumMapKey == BrimstoneAtriumType2Key) - PlaceSchematic(atriumMapKey, atriumPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - else - PlaceSchematic>(atriumMapKey, atriumPlacementPoint, anchorType, ref place); - - Rectangle atriumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(atriumSchematic, atriumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(atriumProtectionArea2, 10); - - int sanctumGenX = ashIslandX + firstStructureDistanceFromIslandEdge; - int sanctumGenY = ashIslandDepthLimit + sanctumOffsetY; - - int strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - int dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - int stockadeGenX = sanctumGenX + (smallWorld ? distanceBetweenStructures_AfterFirstIsland : distanceBetweenStructures_AfterFirstIsland * 2); - int stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX - stockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - Point sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - Point strongholdPlacementPoint = new Point(sanctumGenX - strongholdOffsetX, strongholdGenY + strongholdOffsetY); - Point dungeonPlacementPoint = new Point(sanctumGenX + dungeonOffsetX, dungeonGenY + dungeonOffsetY); - Point stockadePlacementPoint = new Point(stockadeGenX - stockadeOffsetX, stockadeGenY + stockadeOffsetY); - if (largeWorld) - { - PlaceSchematic>(stockadesToGenerate[0], stockadePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle stockadeProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[stockadesToGenerate[0]], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea, 10); - - // Reset the Y index for stockades - stockadeGenY = ashIslandHeightLimit; - while (!Main.tile[stockadeGenX + secondStockadeOffsetX, stockadeGenY].HasTile) - stockadeGenY++; - - // Placement point for the second stockade - int secondStockadeOffsetY = stockadesToGenerate[1] == BarbedStockadeType4Key ? -7 : 8; - stockadePlacementPoint = new Point(stockadeGenX + secondStockadeOffsetX, stockadeGenY + secondStockadeOffsetY); - } - if (!smallWorld) - { - PlaceSchematic>(SanctumofOblivionType1Key, sanctumPlacementPoint, anchorType, ref place); - - Rectangle sanctumProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[SanctumofOblivionType1Key], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea, 10); - - PlaceSchematic(HellstoneStrongholdType1Key, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - Rectangle strongholdProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[HellstoneStrongholdType1Key], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea, 10); - - PlaceSchematic>(DemonicDungeonType1Key, dungeonPlacementPoint, anchorType, ref place); - - Rectangle dungeonProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[DemonicDungeonType1Key], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea, 10); - - sanctumGenX += distanceBetweenStructures_AfterFirstIsland; - - strongholdGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX - strongholdOffsetX, strongholdGenY].HasTile) - strongholdGenY++; - - strongholdPlacementPoint = new Point(sanctumGenX - strongholdOffsetX, strongholdGenY + secondStrongholdOffsetY); - - dungeonGenY = ashIslandHeightLimit; - while (!Main.tile[sanctumGenX + dungeonOffsetX, dungeonGenY].HasTile) - dungeonGenY++; - - dungeonPlacementPoint = new Point(sanctumGenX + dungeonOffsetX, dungeonGenY + dungeonOffsetY); - - sanctumPlacementPoint = new Point(sanctumGenX, sanctumGenY); - } - - string secondStockade = largeWorld ? stockadesToGenerate[1] : stockadesToGenerate[0]; - PlaceSchematic>(secondStockade, stockadePlacementPoint, anchorType, ref place); - - Rectangle stockadeProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStockade], stockadePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(stockadeProtectionArea2, 10); - - string secondSanctum = smallWorld ? SanctumofOblivionType1Key : (WorldGen.genRand.NextBool() ? SanctumofOblivionType2Key : SanctumofOblivionType3Key); - PlaceSchematic>(secondSanctum, sanctumPlacementPoint, anchorType, ref place); - - Rectangle sanctumProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondSanctum], sanctumPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(sanctumProtectionArea2, 10); - - string secondStronghold = smallWorld ? HellstoneStrongholdType1Key : HellstoneStrongholdType2Key; - PlaceSchematic(secondStronghold, strongholdPlacementPoint, anchorType, ref place, new Action(FillAtriumChests)); - - Rectangle strongholdProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondStronghold], strongholdPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(strongholdProtectionArea2, 10); - - string secondDungeon = smallWorld ? DemonicDungeonType1Key : DemonicDungeonType2Key; - PlaceSchematic>(secondDungeon, dungeonPlacementPoint, anchorType, ref place); - - Rectangle dungeonProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondDungeon], dungeonPlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(dungeonProtectionArea2, 10); - } - - // Pick cache types - List caches = new List(); - int numCaches = largeWorld ? 8 : 4; // THIS NUMBER MUST BE EVEN!!! - int cacheTypes = 6; - int totalCachePositions = numCaches / 2; - do - { - // Chose a random cache to add to the list - int chosenCache = WorldGen.genRand.Next(cacheTypes); - - // Don't choose the same cache twice - bool alreadyContainsThisCacheType = caches.Contains(chosenCache); - - // Avoid an infinite loop by picking a random duplicate cache if the max is reached - bool pickRandomDuplicateCache = caches.Count >= cacheTypes; - if (pickRandomDuplicateCache) - pickRandomDuplicateCache = caches[caches.Count - totalCachePositions] != chosenCache; - - if (!alreadyContainsThisCacheType || pickRandomDuplicateCache) - caches.Add(chosenCache); - } - while (caches.Count < numCaches); - - // Chose random caches to not place - // 1 is not placed in a small/medium world - // 3 are not placed in a large world - List cachesToNotPlace = new List(); - int numCachesToNotPlace = largeWorld ? 3 : 1; - do - { - // Chose a random cache to add to the list - int chosenCache = WorldGen.genRand.Next(numCaches); - - // Don't choose the same cache twice - bool alreadyContainsThisCacheType = cachesToNotPlace.Contains(chosenCache); - if (!alreadyContainsThisCacheType) - cachesToNotPlace.Add(chosenCache); - } - while (cachesToNotPlace.Count < numCachesToNotPlace); - - // - // Place caches - // - int cacheGenX = ashIslandX + firstStructureDistanceFromIslandEdge + (distanceBetweenStructures_AfterFirstIsland * numAtriums); - int cacheGenY = ashIslandDepthLimit + cacheOffsetY; - int randomAdjustmentX = 0; - int randomAdjustmentY = 0; - int minRandomX = -30; - int maxRandomX = -20; - int minRandomY = 15; - int maxRandomY = 20; - for (int cacheIndex = 0; cacheIndex < totalCachePositions; cacheIndex++) - { - randomAdjustmentX += WorldGen.genRand.Next(minRandomX, maxRandomX + 1); - randomAdjustmentX = (int)MathHelper.Clamp(randomAdjustmentX, minRandomX, maxRandomX); - randomAdjustmentY += WorldGen.genRand.Next(minRandomY, maxRandomY + 1); - randomAdjustmentY = (int)MathHelper.Clamp(randomAdjustmentY, minRandomY, maxRandomY); - - string cacheMapKey; - switch (caches[cacheIndex]) - { - default: - case 0: - cacheMapKey = BonescrapperCacheType1Key; - break; - - case 1: - cacheMapKey = BonescrapperCacheType2Key; - break; - - case 2: - cacheMapKey = BonescrapperCacheType3Key; - break; - - case 3: - cacheMapKey = BonescrapperCacheType4Key; - break; - - case 4: - cacheMapKey = BonescrapperCacheType5Key; - break; - - case 5: - cacheMapKey = BonescrapperCacheType6Key; - break; - } - - Point cachePlacementPoint = new Point(cacheGenX + randomAdjustmentX, cacheGenY + randomAdjustmentY); - SchematicAnchor anchorType = SchematicAnchor.Center; - bool place = true; - - bool canPlaceEvenCache = true; - switch (cacheIndex) - { - default: - case 0: - canPlaceEvenCache = !cachesToNotPlace.Contains(0); - break; - - case 1: - canPlaceEvenCache = !cachesToNotPlace.Contains(2); - break; - - case 2: - canPlaceEvenCache = !cachesToNotPlace.Contains(4); - break; - - case 3: - canPlaceEvenCache = !cachesToNotPlace.Contains(6); - break; - } - - // Cache types 2, 3, and 6 have chests - if (canPlaceEvenCache) - { - if (cacheMapKey == BonescrapperCacheType2Key || cacheMapKey == BonescrapperCacheType3Key || cacheMapKey == BonescrapperCacheType6Key) - PlaceSchematic(cacheMapKey, cachePlacementPoint, anchorType, ref place, new Action(FillCacheChests)); - else - PlaceSchematic>(cacheMapKey, cachePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle cacheProtectionArea = CalamityUtils.GetSchematicProtectionArea(TileMaps[cacheMapKey], cachePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(cacheProtectionArea, 5); - } - - string secondCacheMapKey; - switch (caches[cacheIndex + totalCachePositions]) - { - default: - case 0: - secondCacheMapKey = BonescrapperCacheType1Key; - break; - - case 1: - secondCacheMapKey = BonescrapperCacheType2Key; - break; - - case 2: - secondCacheMapKey = BonescrapperCacheType3Key; - break; - - case 3: - secondCacheMapKey = BonescrapperCacheType4Key; - break; - - case 4: - secondCacheMapKey = BonescrapperCacheType5Key; - break; - - case 5: - secondCacheMapKey = BonescrapperCacheType6Key; - break; - } - - bool canPlaceOddCache = true; - switch (cacheIndex) - { - default: - case 0: - canPlaceOddCache = !cachesToNotPlace.Contains(1); - break; - - case 1: - canPlaceOddCache = !cachesToNotPlace.Contains(3); - break; - - case 2: - canPlaceOddCache = !cachesToNotPlace.Contains(5); - break; - - case 3: - canPlaceOddCache = !cachesToNotPlace.Contains(7); - break; - } - - // Place second cache to the right of the first - if (canPlaceOddCache) - { - Point secondCachePlacementPoint = cachePlacementPoint + new Point(WorldGen.genRand.Next(60, 76), 0); - if (secondCacheMapKey == BonescrapperCacheType2Key || secondCacheMapKey == BonescrapperCacheType3Key || secondCacheMapKey == BonescrapperCacheType6Key) - PlaceSchematic(secondCacheMapKey, secondCachePlacementPoint, anchorType, ref place, new Action(FillCacheChests)); - else - PlaceSchematic>(secondCacheMapKey, secondCachePlacementPoint, anchorType, ref place); - - // Protect the structure - Rectangle cacheProtectionArea2 = CalamityUtils.GetSchematicProtectionArea(TileMaps[secondCacheMapKey], secondCachePlacementPoint, anchorType); - CalamityUtils.AddProtectedStructure(cacheProtectionArea2, 5); - } - - // Reset positions and move cache placement along the X axis - cacheGenX = ashIslandX + firstStructureDistanceFromIslandEdge + (distanceBetweenStructures_AfterFirstIsland * (numAtriums + cacheIndex + 1)); - cacheGenY = ashIslandDepthLimit + cacheOffsetY; - } - } - } - - public static void AshTreesAndGrass() - { - // Start generating islands at this point - int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenStart_Remix : AshIslandGenStart)); - - // Stop generating islands at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? AshIslandGenEnd_Remix : AshIslandGenEnd)); - - // Ash island gen limits - int ashIslandDepthLimit = Main.maxTilesY - AshIslandDepthMaxAboveTheUnderworldFloor; - - // Place ash trees - for (int x = ashIslandX; x < ashIslandX2 + 15; x++) - { - for (int y = Main.maxTilesY - 200; y < ashIslandDepthLimit + 30; y++) - { - if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) - WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); - } - } - - // Drunk world ash grass and trees - if (WorldGen.drunkWorldGen) - { - for (int x = 25; x < Main.maxTilesX - 25; x++) - { - for (int y = Main.maxTilesY - 300; y < Main.maxTilesY - 100 + WorldGen.genRand.Next(-1, 2); y++) - { - if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && - (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || - !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || - !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || - !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) - Main.tile[x, y].TileType = TileID.AshGrass; - } - } - - for (int x = 25; x < Main.maxTilesX - 25; x++) - { - for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 50; y++) - { - if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) - WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); - } - } - } - } - - public static void PlaceGeyserTraps() - { - // Place Geyser Traps on ash islands - // These are only generated in the no-man's land central islands - if (!WorldGen.remixWorldGen) - { - // Large = 8, Medium = 6, Small = 4 - // No-man's land islands: Large = 4, Medium = 2, Small = 2 - int numIslands = (int)(Main.maxTilesX / 4200f * 4f); - bool mediumWorld = numIslands == MediumWorldIslands; - - // Start generating traps at this point - int ashIslandX = (int)((double)Main.maxTilesX * (mediumWorld ? 0.453 : 0.43)); - - // Stop generating traps at this point - int ashIslandX2 = (int)((double)Main.maxTilesX * (mediumWorld ? 0.546 : 0.57)); - - // Small = 12.6 Medium = 19.2 Large = 25.2 - double trapFrequency = (double)Main.maxTilesX * 0.003; - if (WorldGen.noTrapsWorldGen) - trapFrequency = ((!WorldGen.tenthAnniversaryWorldGen && !WorldGen.notTheBees) ? (trapFrequency * 100D) : (trapFrequency * 5D)); - else if (WorldGen.getGoodWorldGen) - trapFrequency *= 1.5; - - if (Main.starGame) - trapFrequency *= Main.starGameMath(0.2); - - int maxTrapPlacementAttempts = 1150; - for (int trapIndex = 0; (double)trapIndex < trapFrequency; trapIndex++) - { - for (int trapIndex2 = 0; trapIndex2 < maxTrapPlacementAttempts; trapIndex2++) - { - int trapPlacementX = WorldGen.genRand.Next(ashIslandX, ashIslandX2); - int trapPlacementY = WorldGen.genRand.Next(Main.maxTilesY - AshIslandHeightMaxAboveTheUnderworldFloor, Main.maxTilesY - 100); - - if (GeyserTraps(trapPlacementX, trapPlacementY)) - break; - } - } - } - } - - private static bool GeyserTraps(int geyserX, int geyserY) - { - int geyserPlacementY = geyserY; - - while (!WorldGen.SolidTile(geyserX, geyserPlacementY)) - { - geyserPlacementY++; - if (geyserPlacementY > Main.maxTilesY - 10) - return false; - } - - geyserPlacementY--; - - if (!WorldGen.InWorld(geyserX, geyserPlacementY, 3)) - return false; - - if (Main.tile[geyserX, geyserPlacementY].HasUnactuatedTile || - Main.tile[geyserX - 1, geyserPlacementY].HasUnactuatedTile || - Main.tile[geyserX + 1, geyserPlacementY].HasUnactuatedTile || - Main.tile[geyserX, geyserPlacementY - 1].HasUnactuatedTile || - Main.tile[geyserX - 1, geyserPlacementY - 1].HasUnactuatedTile || - Main.tile[geyserX + 1, geyserPlacementY - 1].HasUnactuatedTile || - Main.tile[geyserX, geyserPlacementY - 2].HasUnactuatedTile || - Main.tile[geyserX - 1, geyserPlacementY - 2].HasUnactuatedTile || - Main.tile[geyserX + 1, geyserPlacementY - 2].HasUnactuatedTile) - return false; - - if (Main.tile[geyserX + 1, geyserPlacementY].HasTile) - return false; - - // Only place on ash grass to avoid placing in the schematics - if (Main.tile[geyserX, geyserPlacementY + 1].TileType != TileID.AshGrass || - Main.tile[geyserX + 1, geyserPlacementY + 1].TileType != TileID.AshGrass) - return false; - - for (int k = geyserX; k <= geyserX + 1; k++) - { - int j2 = geyserPlacementY + 1; - if (!WorldGen.SolidTile(k, j2)) - return false; - } - - int geyserPlacementY2 = WorldGen.genRand.Next(2); - for (int l = 0; l < 2; l++) - { - Main.tile[geyserX + l, geyserPlacementY].Get().HasTile = true; - Main.tile[geyserX + l, geyserPlacementY].TileType = TileID.GeyserTrap; - Main.tile[geyserX + l, geyserPlacementY].TileFrameX = (short)(18 * l + 36 * geyserPlacementY2); - Main.tile[geyserX + l, geyserPlacementY].TileFrameY = 0; - } - - return true; - } - - private static void AddHellHouses() - { - // Original tower gen area was the outer quarters of the underworld - // New tower gen area is the outer thirds of the underworld - int towerGenArea = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.25 : 0.33)); - - // Generate towers - for (int i = 100; i < Main.maxTilesX - 100; i++) - { - if (i > towerGenArea && i < Main.maxTilesX - towerGenArea) - continue; - - int hellFortGenY = Main.maxTilesY - 40; - while (Main.tile[i, hellFortGenY].HasTile || Main.tile[i, hellFortGenY].LiquidAmount > 0) - hellFortGenY--; - - if (Main.tile[i, hellFortGenY + 1].HasTile) - { - ushort hellFortTileType = (ushort)WorldGen.genRand.Next(TileID.ObsidianBrick, TileID.HellstoneBrick + 1); - ushort wallType = WallID.HellstoneBrickUnsafe; - if (WorldGen.genRand.Next(5) > 0) - hellFortTileType = TileID.ObsidianBrick; - - if (hellFortTileType == TileID.ObsidianBrick) - wallType = WallID.ObsidianBrickUnsafe; - - if (WorldGen.getGoodWorldGen) - hellFortTileType = TileID.HellstoneBrick; - - // Place tower - WorldGen.HellFort(i, hellFortGenY, hellFortTileType, (byte)wallType); - - // Move index further along to keep towers spread apart - // Original min and max values were, respectively, 30 and 130 - // New min and max values are, respectively, 30 and 60 - i += WorldGen.genRand.Next(30, WorldGen.remixWorldGen ? 130 : 60); - - // Randomly add more distance between towers - // Original max value was 200 - // New max value is 50 - if (WorldGen.genRand.NextBool(10)) - i += WorldGen.genRand.Next(WorldGen.remixWorldGen ? 200 : 50); - } - } - - // Placing torches in towers - float torchAmountMult = Main.maxTilesX / 4200f; - for (int torchIndex = 0; (float)torchIndex < 200f * torchAmountMult; torchIndex++) - { - int attempts = 0; - bool placedTorch = false; - while (!placedTorch) - { - attempts++; - int x = WorldGen.genRand.Next((int)((double)Main.maxTilesX * 0.2), (int)((double)Main.maxTilesX * 0.8)); - int y = WorldGen.genRand.Next(Main.maxTilesY - 300, Main.maxTilesY - 20); - if (Main.tile[x, y].HasTile && (Main.tile[x, y].TileType == TileID.ObsidianBrick || Main.tile[x, y].TileType == TileID.HellstoneBrick)) - { - int xOffset = 0; - if (Main.tile[x - 1, y].WallType > WallID.None) - xOffset = -1; - else if (Main.tile[x + 1, y].WallType > WallID.None) - xOffset = 1; - - if (!Main.tile[x + xOffset, y].HasTile && !Main.tile[x + xOffset, y + 1].HasTile) - { - // Check if a torch has already been placed in this location - bool torchAlreadyPlaced = false; - for (int k = x - 8; k < x + 8; k++) - { - for (int l = y - 8; l < y + 8; l++) - { - if (Main.tile[k, l].HasTile && TileID.Sets.Torch[Main.tile[k, l].TileType]) - { - torchAlreadyPlaced = true; - break; - } - } - } - - // Place the torch - if (!torchAlreadyPlaced) - { - WorldGen.PlaceTile(x + xOffset, y, TileID.Torches, mute: true, forced: true, -1, 7); - placedTorch = true; - } - } - } - - if (attempts > 1000) - placedTorch = true; - } - } - - // Place furniture in the towers - double furnitureAmount = 4200000D / (double)Main.maxTilesX; - for (int furnitureIndex = 0; (double)furnitureIndex < furnitureAmount; furnitureIndex++) - { - int attempts = 0; - int furniturePlacementX = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); - int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - while ((Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) - { - furniturePlacementX = WorldGen.genRand.NextBool(2) ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); - y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - - attempts++; - if (attempts > 100000) - break; - } - - if (attempts > 100000 || (Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) - continue; - - for (; !WorldGen.SolidTile(furniturePlacementX, y) && y < Main.maxTilesY - 20; y++) - { - } - - y--; - int placementAdjustment = furniturePlacementX; - int placementAdjustment2 = furniturePlacementX; - while (!Main.tile[placementAdjustment, y].HasTile && WorldGen.SolidTile(placementAdjustment, y + 1)) - placementAdjustment--; - - placementAdjustment++; - for (; !Main.tile[placementAdjustment2, y].HasTile && WorldGen.SolidTile(placementAdjustment2, y + 1); placementAdjustment2++) - { - } - - placementAdjustment2--; - int placementSpaceLimit = placementAdjustment2 - placementAdjustment; - int x = (placementAdjustment2 + placementAdjustment) / 2; - if (Main.tile[x, y].HasTile || (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || !WorldGen.SolidTile(x, y + 1)) - continue; - - // Different styles of houses - int style = 16; - int style2 = 13; - int style3 = 14; - int style4 = 49; - int style5 = 4; - int style6 = 8; - int style7 = 15; - int style8 = 9; - int style9 = 10; - int style10 = 17; - int style11 = 25; - int style12 = 25; - int style13 = 23; - int style14 = 25; - int styleChoice = WorldGen.genRand.Next(13); - int sizeX = 0; - int sizeY = 0; - if (styleChoice == 0) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 1) - { - sizeX = 4; - sizeY = 3; - } - - if (styleChoice == 2) - { - sizeX = 3; - sizeY = 5; - } - - if (styleChoice == 3) - { - sizeX = 4; - sizeY = 6; - } - - if (styleChoice == 4) - { - sizeX = 3; - sizeY = 3; - } - - if (styleChoice == 5) - { - sizeX = 5; - sizeY = 3; - } - - if (styleChoice == 6) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 7) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 8) - { - sizeX = 5; - sizeY = 4; - } - - if (styleChoice == 9) - { - sizeX = 3; - sizeY = 5; - } - - if (styleChoice == 10) - { - sizeX = 5; - sizeY = 3; - } - - if (styleChoice == 11) - { - sizeX = 2; - sizeY = 4; - } - - if (styleChoice == 12) - { - sizeX = 3; - sizeY = 3; - } - - // Check if there are any tiles in the way of furniture placement - for (int placementIndexX = x - sizeX; placementIndexX <= x + sizeX; placementIndexX++) - { - for (int placementIndexY = y - sizeY; placementIndexY <= y; placementIndexY++) - { - if (Main.tile[placementIndexX, placementIndexY].HasTile) - { - styleChoice = -1; - break; - } - } - } - - // Check if there is enough space to place furniture - if ((double)placementSpaceLimit < (double)sizeX * 1.75) - styleChoice = -1; - - switch (styleChoice) - { - case 0: - WorldGen.PlaceTile(x, y, TileID.Tables, mute: true, forced: false, -1, style2); - int candlePlacementX = WorldGen.genRand.Next(6); - if (candlePlacementX < 3) - WorldGen.PlaceTile(x + candlePlacementX, y - 2, TileID.Candles, mute: true, forced: false, -1, style12); - - if (!Main.tile[x, y].HasTile) - break; - - if (!Main.tile[x - 2, y].HasTile) - { - WorldGen.PlaceTile(x - 2, y, TileID.Chairs, mute: true, forced: false, -1, style); - if (Main.tile[x - 2, y].HasTile) - { - Main.tile[x - 2, y].TileFrameX += 18; - Main.tile[x - 2, y - 1].TileFrameX += 18; - } - } - - if (!Main.tile[x + 2, y].HasTile) - WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); - - break; - - case 1: - WorldGen.PlaceTile(x, y, TileID.WorkBenches, mute: true, forced: false, -1, style3); - int candlePlacementX2 = WorldGen.genRand.Next(4); - if (candlePlacementX2 < 2) - WorldGen.PlaceTile(x + candlePlacementX2, y - 1, TileID.Candles, mute: true, forced: false, -1, style12); - - if (!Main.tile[x, y].HasTile) - break; - - if (WorldGen.genRand.NextBool()) - { - if (!Main.tile[x - 1, y].HasTile) - { - WorldGen.PlaceTile(x - 1, y, TileID.Chairs, mute: true, forced: false, -1, style); - if (Main.tile[x - 1, y].HasTile) - { - Main.tile[x - 1, y].TileFrameX += 18; - Main.tile[x - 1, y - 1].TileFrameX += 18; - } - } - } - else if (!Main.tile[x + 2, y].HasTile) - WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); - - break; - - case 2: - WorldGen.PlaceTile(x, y, TileID.Statues, mute: true, forced: false, -1, style4); - break; - - case 3: - WorldGen.PlaceTile(x, y, TileID.Bookcases, mute: true, forced: false, -1, style5); - break; - - case 4: - - if (WorldGen.genRand.NextBool()) - { - WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); - Main.tile[x, y].TileFrameX += 18; - Main.tile[x, y - 1].TileFrameX += 18; - } - else - WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); - - break; - - case 5: - if (WorldGen.genRand.NextBool()) - WorldGen.Place4x2(x, y, TileID.Beds, 1, style6); - else - WorldGen.Place4x2(x, y, TileID.Beds, -1, style6); - break; - - case 6: - WorldGen.PlaceTile(x, y, TileID.Pianos, mute: true, forced: false, -1, style7); - break; - - case 7: - WorldGen.PlaceTile(x, y, TileID.Dressers, mute: true, forced: false, -1, style8); - break; - - case 8: - WorldGen.PlaceTile(x, y, TileID.Benches, mute: true, forced: false, -1, style9); - break; - - case 9: - WorldGen.PlaceTile(x, y, TileID.GrandfatherClocks, mute: true, forced: false, -1, style10); - break; - - case 10: - if (WorldGen.genRand.NextBool()) - WorldGen.Place4x2(x, y, TileID.Bathtubs, 1, style14); - else - WorldGen.Place4x2(x, y, TileID.Bathtubs, -1, style14); - break; - - case 11: - WorldGen.PlaceTile(x, y, TileID.Lamps, mute: true, forced: false, -1, style13); - break; - - case 12: - WorldGen.PlaceTile(x, y, TileID.Candelabras, mute: true, forced: false, -1, style11); - break; - } - } - - // Place paintings in the towers - furnitureAmount = 420000D / (double)Main.maxTilesX; - for (int paintingIndex = 0; (double)paintingIndex < furnitureAmount; paintingIndex++) - { - int attempts = 0; - int x = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); - int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - while ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile) - { - x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); - y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - - attempts++; - if (attempts > 100000) - break; - } - - if (attempts > 100000) - continue; - - int paintingPlacementX = x; - int paintingPlacementX2 = x; - int paintingPlacementY = y; - int paintingPlacementY2 = y; - int sizeY = 0; - for (int num32 = 0; num32 < 2; num32++) - { - paintingPlacementX = x; - paintingPlacementX2 = x; - while (!Main.tile[paintingPlacementX, y].HasTile && (Main.tile[paintingPlacementX, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX, y].WallType == WallID.ObsidianBrickUnsafe)) - paintingPlacementX--; - - paintingPlacementX++; - for (; !Main.tile[paintingPlacementX2, y].HasTile && (Main.tile[paintingPlacementX2, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX2, y].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementX2++) - { - } - - paintingPlacementX2--; - x = (paintingPlacementX + paintingPlacementX2) / 2; - paintingPlacementY = y; - paintingPlacementY2 = y; - while (!Main.tile[x, paintingPlacementY].HasTile && (Main.tile[x, paintingPlacementY].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY].WallType == WallID.ObsidianBrickUnsafe)) - paintingPlacementY--; - - paintingPlacementY++; - for (; !Main.tile[x, paintingPlacementY2].HasTile && (Main.tile[x, paintingPlacementY2].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY2].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementY2++) - { - } - - paintingPlacementY2--; - y = (paintingPlacementY + paintingPlacementY2) / 2; - } - - // Clamp this due to out of bounds errors - y = (int)MathHelper.Clamp(y, 1, Main.maxTilesY - 1); - - paintingPlacementX = x; - paintingPlacementX2 = x; - while (!Main.tile[paintingPlacementX, y].HasTile && !Main.tile[paintingPlacementX, y - 1].HasTile && !Main.tile[paintingPlacementX, y + 1].HasTile) - { - paintingPlacementX--; - - // Ensure we don't get out of bounds errors - if (paintingPlacementX < 0) - { - paintingPlacementX = 0; - break; - } - } - - paintingPlacementX++; - for (; !Main.tile[paintingPlacementX2, y].HasTile && !Main.tile[paintingPlacementX2, y - 1].HasTile && !Main.tile[paintingPlacementX2, y + 1].HasTile; paintingPlacementX2++) - { - } - - paintingPlacementX2--; - paintingPlacementY = y; - paintingPlacementY2 = y; - while (!Main.tile[x, paintingPlacementY].HasTile && !Main.tile[x - 1, paintingPlacementY].HasTile && !Main.tile[x + 1, paintingPlacementY].HasTile) - paintingPlacementY--; - - paintingPlacementY++; - for (; !Main.tile[x, paintingPlacementY2].HasTile && !Main.tile[x - 1, paintingPlacementY2].HasTile && !Main.tile[x + 1, paintingPlacementY2].HasTile; paintingPlacementY2++) - { - } - - paintingPlacementY2--; - x = (paintingPlacementX + paintingPlacementX2) / 2; - y = (paintingPlacementY + paintingPlacementY2) / 2; - int sizeX = paintingPlacementX2 - paintingPlacementX; - sizeY = paintingPlacementY2 - paintingPlacementY; - if (sizeX <= 7 || sizeY <= 5) - continue; - - if (!WorldGen.nearPicture2(x, y)) - { - PaintingEntry paintingEntry = WorldGen.RandHellPicture(); - if (!WorldGen.nearPicture(x, y)) - WorldGen.PlaceTile(x, y, paintingEntry.tileType, mute: true, forced: false, -1, paintingEntry.style); - } - } - - // An array used for banner styles - int[] bannerArray = new int[3] - { - WorldGen.genRand.Next(16, 22), - WorldGen.genRand.Next(16, 22), - WorldGen.genRand.Next(16, 22) - }; - - while (bannerArray[1] == bannerArray[0]) - bannerArray[1] = WorldGen.genRand.Next(16, 22); - - while (bannerArray[2] == bannerArray[0] || bannerArray[2] == bannerArray[1]) - bannerArray[2] = WorldGen.genRand.Next(16, 22); - - // Place hanging tiles - furnitureAmount = 420000D / (double)Main.maxTilesX; - for (int hangingTileIndex = 0; (double)hangingTileIndex < furnitureAmount; hangingTileIndex++) - { - int attempts = 0; - int x; - int y; - do - { - x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); - y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); - attempts++; - } - while (attempts <= 100000 && ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile)); - - if (attempts > 100000) - continue; - - while (!WorldGen.SolidTile(x, y) && y > 10) - y--; - - y++; - if (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) - continue; - - int hangingTileType = WorldGen.genRand.Next(3); - int chandelierStyle = 32; - int lanternStyle = 32; - int hangingTileSizeX; - int hangingTileSizeY; - switch (hangingTileType) - { - default: - hangingTileSizeX = 1; - hangingTileSizeY = 3; - break; - case 1: - hangingTileSizeX = 3; - hangingTileSizeY = 3; - break; - case 2: - hangingTileSizeX = 1; - hangingTileSizeY = 2; - break; - } - - for (int placementIndexX = x - 1; placementIndexX <= x + hangingTileSizeX; placementIndexX++) - { - for (int placementIndexY = y; placementIndexY <= y + hangingTileSizeY; placementIndexY++) - { - Tile tile = Main.tile[x, y]; - if (placementIndexX < x || placementIndexX == x + hangingTileSizeX) - { - if (tile.HasTile) - { - switch (tile.TileType) - { - case TileID.ClosedDoor: - case TileID.OpenDoor: - case TileID.Chandeliers: - case TileID.HangingLanterns: - case TileID.Banners: - hangingTileType = -1; - break; - } - } - } - else if (tile.HasTile) - hangingTileType = -1; - } - } - - switch (hangingTileType) - { - case 0: - WorldGen.PlaceTile(x, y, TileID.Banners, mute: true, forced: false, -1, bannerArray[WorldGen.genRand.Next(3)]); - break; - case 1: - WorldGen.PlaceTile(x, y, TileID.Chandeliers, mute: true, forced: false, -1, chandelierStyle); - break; - case 2: - WorldGen.PlaceTile(x, y, TileID.HangingLanterns, mute: true, forced: false, -1, lanternStyle); - break; - } - } - } - - private static void FillAtriumChests(Chest chest, int Type, bool place) - { - int shadowChestItems = Utils.SelectRandom(WorldGen.genRand, ItemID.Sunfury, ItemID.FlowerofFire, ItemID.Flamelash, ItemID.DarkLance, ItemID.HellwingBow); - int shadowChestItems2 = Utils.SelectRandom(WorldGen.genRand, ItemID.HellMinecart, ItemID.OrnateShadowKey, ItemID.HellCake); - List contents = new List() - { - new ChestItem(shadowChestItems, 1), - new ChestItem(shadowChestItems2, 1), - new ChestItem(ItemID.ObsidianSkinPotion, WorldGen.genRand.Next(2, 5)), - new ChestItem(ItemID.LifeforcePotion, WorldGen.genRand.Next(2, 5)), - new ChestItem(ItemID.TeleportationPotion, WorldGen.genRand.Next(2, 5)), - new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(3, 6)), - }; - - for (int i = 0; i < contents.Count; i++) - { - chest.item[i].SetDefaults(contents[i].Type); - chest.item[i].Prefix(-1); - chest.item[i].stack = contents[i].Stack; - } - } - - private static void FillCacheChests(Chest chest, int Type, bool place) - { - int shadowChestItems = Utils.SelectRandom(WorldGen.genRand, ItemID.Sunfury, ItemID.FlowerofFire, ItemID.Flamelash, ItemID.DarkLance, ItemID.HellwingBow); - int barTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.MeteoriteBar, GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar); - int ammoTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.HellfireArrow, GenVars.silverBar == TileID.Silver ? ItemID.SilverBullet : ItemID.TungstenBullet); - int potionTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.ManaRegenerationPotion, ItemID.MagicPowerPotion, ItemID.InvisibilityPotion, ItemID.HunterPotion, ItemID.HeartreachPotion); - int potionTypes2 = Utils.SelectRandom(WorldGen.genRand, ItemID.GravitationPotion, ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.BattlePotion, ItemID.InfernoPotion); - int potionTypes3 = Utils.SelectRandom(WorldGen.genRand, ItemID.RecallPotion, ItemID.PotionOfReturn); - int lightSourceTypes = Utils.SelectRandom(WorldGen.genRand, ItemID.Torch, ItemID.Glowstick); - List contents = new List() - { - new ChestItem(shadowChestItems, 1), - new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(1, 3)), - new ChestItem(barTypes, WorldGen.genRand.Next(15, 31)), - new ChestItem(ammoTypes, WorldGen.genRand.Next(50, 76)), - new ChestItem(ItemID.RestorationPotion, WorldGen.genRand.Next(15, 21)), - new ChestItem(potionTypes, WorldGen.genRand.Next(1, 3)), - new ChestItem(potionTypes2, WorldGen.genRand.Next(1, 3)), - new ChestItem(potionTypes3, WorldGen.genRand.Next(1, 3)), - new ChestItem(lightSourceTypes, WorldGen.genRand.Next(15, 31)), - new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 5)), - }; - - for (int i = 0; i < contents.Count; i++) - { - chest.item[i].SetDefaults(contents[i].Type); - chest.item[i].Prefix(-1); - chest.item[i].stack = contents[i].Stack; - } - } - } -} diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index b4441f1453..cd940120f8 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -307,7 +307,7 @@ namespace CalamityMod.World #region Sunken Sea Lab - public static void FillSunkenSeaLaboratoryChest(Chest chest, int type, bool hasPlacedLogAndSchematic) + public static void FillSunkenSeaLaboratoryChest(Chest chest, int type, bool notFirstChest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); List contents = new List() @@ -324,7 +324,7 @@ namespace CalamityMod.World //Adds the Planetoid Seeking Mechanism contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - if (!hasPlacedLogAndSchematic) + if (notFirstChest) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); @@ -396,7 +396,7 @@ namespace CalamityMod.World #endregion #region Ice Lab - public static void FillIceLaboratoryChest(Chest chest, int type, bool hasPlacedLogAndSchematic) + public static void FillIceLaboratoryChest(Chest chest, int type, bool notFirstChest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); List contents = new List() @@ -413,7 +413,7 @@ namespace CalamityMod.World //Adds the Base Seeking Mechanism contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - if (!hasPlacedLogAndSchematic) + if (notFirstChest) { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 1f37a9c1d9..6f293816e3 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Food; +using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.FurnitureAuric; @@ -564,5 +565,36 @@ namespace CalamityMod.World } } #endregion + + #region Iron Ball + public static void GenerateIronBall() + { + int ballID = ModContent.TileType(); + int attempts = 0; + int ballsPlaced = 0; + int worldSize = WorldGen.GetWorldSize(); + // Same amount as Chillet + int maxBalls = worldSize switch + { + 1 => 9, + 2 => 12, + _ => 6, + }; + while (attempts < 10000) + { + Point location = new Point(WorldGen.genRand.Next(100, Main.maxTilesX - 100), WorldGen.genRand.Next((int)Main.rockLayer, Main.UnderworldLayer)); + Tile t = CalamityUtils.ParanoidTileRetrieval(location.X, location.Y); + Tile above = CalamityUtils.ParanoidTileRetrieval(location.X, location.Y - 1); + if (t.TileType == TileID.Stone && t.HasTile && !above.HasTile) + { + WorldGen.SlopeTile(location.X, location.Y); + WorldGen.PlaceTile(location.X, location.Y - 1, ballID); + ballsPlaced++; + } + if (ballsPlaced >= maxBalls) + break; + } + } + #endregion } } diff --git a/World/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 510e655dc5..92f106df70 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -430,7 +430,6 @@ 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), @@ -439,7 +438,7 @@ namespace CalamityMod.World new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 10 + 1)), new ChestItem(ItemID.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) @@ -452,7 +451,6 @@ namespace CalamityMod.World new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 10 + 1)), new ChestItem(ItemID.Eggnog, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(ItemType(), WorldGen.genRand.Next(200, 349 + 1)), new ChestItem(Main.rand.NextBool() ? ItemID.GasTrap : ItemID.Marshmallow, 1) }; } diff --git a/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